code: def lock(self, lock=True, changelist=0):
          
  
          cmd = 'lock' if lock else 'unlock'
          if changelist:
              self._connection.run([cmd, '-c', changelist, self.depotFile])
          else:
              self._connection.run([cmd, self.depotFile])
  
          self.query()
docs: Locks or unlocks the file
  
          :param lock: Lock or unlock the file
          :type lock: bool
          :param changelist: Optional changelist to checkout the file into
          :type changelist: :class:`.Changelist`