def openStream(self, source):
        """Produces a file object from source.

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

        """
        # Already a file object
        if hasattr(source, 'read'):
            stream = source
        else:
            stream = StringIO(source)

        return stream
Produces a file object from source.

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

        
product/gradle-plugin/src/main/python/pip/_vendor/html5lib/_inputstream.py