import six


def byte_adaptor(fbuffer):
    """ provides py3 compatibility by converting byte based
    file stream to string based file stream

    Arguments:
        fbuffer: file like objects containing bytes

    Returns:
        string buffer
    """
    if six.PY3:
        strings = fbuffer.read().decode('utf-8')
        fbuffer = six.StringIO(strings)
        return fbuffer
    else:
        return fbuffer