'Produces a file object from source.
source can be either a file object, local filename or a string.'

def openStream(self, source):

    if hasattr(source, u'read'):
        stream = source
    else:
        stream = BytesIO(source)
    try:
        stream.seek(stream.tell())
    except:
        stream = BufferedStream(stream)
    return stream
