code: def _modify(self, paths: Union[str, List[str]], metadata_for_paths: Union[IrodsMetadata, List[IrodsMetadata]],
                  operation: str):
          
          if isinstance(paths, str):
              paths = [paths]
          if isinstance(metadata_for_paths, IrodsMetadata):
              metadata_for_paths = [metadata_for_paths for _ in paths]
          elif len(paths) != len(metadata_for_paths):
              raise ValueError("Metadata not supplied for all paths - either supply a single IrodsMetadata collection "
                               "to apply for all paths or supply a collection for each path")
  
          assert len(paths) == len(metadata_for_paths)
          baton_in_json = []
          for i in range(len(metadata_for_paths)):
              entity = self._create_entity_with_path(paths[i])
              entity.metadata = metadata_for_paths[i]
              baton_in_json.append(self._entity_to_baton_json(entity))
          arguments = [BATON_METAMOD_OPERATION_FLAG, operation]
          self.run_baton_query(BatonBinary.BATON_METAMOD, arguments, input_data=baton_in_json)
docs: Modifies the metadata of the entity or entities in iRODS with the given path.
          :param path: the paths of the entity or entities to modify
          :param metadata_for_paths: the metadata to change. If only one metadata object is given, that metadata is set
          for all, else the metadata is matched against the path with the corresponding index
          :param operation: the baton operation used to modify the metadata