code: def create_slim_mapping(self, subset=None, subset_nodes=None, relations=None, disable_checks=False):
          
          if subset is not None:
              subset_nodes = self.extract_subset(subset)
              logger.info("Extracting subset: {} -> {}".format(subset, subset_nodes))
  
          if subset_nodes is None or len(subset_nodes) == 0:
              raise ValueError("subset nodes is blank")
          subset_nodes = set(subset_nodes)
          logger.debug("SUBSET: {}".format(subset_nodes))
  
          # Use a sub-ontology for mapping
          subont = self
          if relations is not None:
              subont = self.subontology(relations=relations)
  
          if not disable_checks:
              for r in subont.relations_used():
                  if r != 'subClassOf' and r != 'BFO:0000050' and r != 'subPropertyOf':
                      raise ValueError("Not safe to propagate over a graph with edge type: {}".format(r))
  
          m = {}
          for n in subont.nodes():
              ancs = subont.ancestors(n, reflexive=True)
              ancs_in_subset = subset_nodes.intersection(ancs)
              m[n] = list(subont.filter_redundant(ancs_in_subset))
          return m
docs: Create a dictionary that maps between all nodes in an ontology to a subset
  
          Arguments
          ---------
          ont : `Ontology`
              Complete ontology to be mapped. Assumed pre-filtered for relationship types
          subset : str
              Name of subset to map to, e.g. goslim_generic
          nodes : list
              If no named subset provided, subset is passed in as list of node ids
          relations : list
              List of relations to filter on
          disable_checks: bool
              Unless this is set, this will prevent a mapping being generated with non-standard relations.
              The motivation here is that the ontology graph may include relations that it is inappropriate to
              propagate gene products over, e.g. transports, has-part
  
          Return
          ------
          dict
              maps all nodes in ont to one or more non-redundant nodes in subset
  
          Raises
          ------
          ValueError
              if the subset is empty