def to_binary(val):
    return bin(val)


def to_ascii(val):
    return ord(str(val))


def to_character(val, is_unicode=True):
    if is_unicode is True:
        return unichr(val)
    else:
        return chr(val)


def to_octal(val):
    return oct(val)


def to_hexadecimal(val):
    return hex(val)


def from_bin_to_str(val):
    s = ""
    data = str(val).split(" ")
    for i in data:
        s += chr(int(i, 2))
    return s


def from_str_to_bin(val):
    b = ""
    for i in val:
        b += " " + str(bin(ord(i))).lstrip("0b")
    return b

modify code