code: def openStream(self, source):
          
          # Already a file object
          if hasattr(source, 'read'):
              stream = source
          else:
              stream = BytesIO(source)
  
          try:
              stream.seek(stream.tell())
          except:  # pylint:disable=bare-except
              stream = BufferedStream(stream)
  
          return stream
docs: Produces a file object from source.
  
          source can be either a file object, local filename or a string.