code: def open(filename, connection=None):
      
      c = connection or connect()
      res = c.ls(filename)
      if res and res[0].revision:
          res[0].edit()
      else:
          c.add(filename)
docs: Edits or Adds a filename ensuring the file is in perforce and editable
  
      :param filename: File to check out
      :type filename: str
      :param connection: Connection object to use
      :type connection: :py:class:`Connection`