code: def expand_repertoire(self, direction, repertoire, new_purview=None):
          
          if repertoire is None:
              return None
  
          purview = distribution.purview(repertoire)
  
          if new_purview is None:
              new_purview = self.node_indices  # full subsystem
  
          if not set(purview).issubset(new_purview):
              raise ValueError("Expanded purview must contain original purview.")
  
          # Get the unconstrained repertoire over the other nodes in the network.
          non_purview_indices = tuple(set(new_purview) - set(purview))
          uc = self.unconstrained_repertoire(direction, non_purview_indices)
          # Multiply the given repertoire by the unconstrained one to get a
          # distribution over all the nodes in the network.
          expanded_repertoire = repertoire * uc
  
          return distribution.normalize(expanded_repertoire)
docs: Distribute an effect repertoire over a larger purview.
  
          Args:
              direction (Direction): |CAUSE| or |EFFECT|.
              repertoire (np.ndarray): The repertoire to expand.
  
          Keyword Args:
              new_purview (tuple[int]): The new purview to expand the repertoire
                  over. If ``None`` (the default), the new purview is the entire
                  network.
  
          Returns:
              np.ndarray: A distribution over the new purview, where probability
              is spread out over the new nodes.
  
          Raises:
              ValueError: If the expanded purview doesn't contain the original
                  purview.