def METHOD_NAME(s):
    if isinstance(s, str):
        return s.encode("utf-8")
    elif isinstance(s, bytes):
        return s
    elif isinstance(s, int):
        return bytes([s])
    else:
        raise TypeError("Invalid argument {!r} for b()".format(s))