def _make_binary_stream(s, encoding):
    if _py3k:
        if isinstance(s, str):
            s = s.encode(encoding)
    else:
        if type(s) is not str:
            s = s.encode(encoding)
    try:
        from io import BytesIO
        rv = BytesIO(s)
    except __HOLE__:
        rv = StringIO(s)
    return rv
dataset/ETHPy150Open buanzo/jiffy/gnupg.py/_make_binary_stream