'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 = StringIO(source)
    return stream
