code: def get_components(self, which):
          
          mappings = self.representation_mappings.get(
              getattr(self, which).__class__, [])
  
          old_to_new = dict()
          for name in getattr(self, which).components:
              for m in mappings:
                  if isinstance(m, RegexRepresentationMapping):
                      pattr = re.match(m.repr_name, name)
                      old_to_new[name] = m.new_name.format(*pattr.groups())
  
                  elif m.repr_name == name:
                      old_to_new[name] = m.new_name
  
          mapping = OrderedDict()
          for name in getattr(self, which).components:
              mapping[old_to_new.get(name, name)] = name
  
          return mapping
docs: Get the component name dictionary for the desired object.
  
          The returned dictionary maps component names on this class to component
          names on the desired object.
  
          Parameters
          ----------
          which : str
              Can either be ``'pos'`` or ``'vel'`` to get the components for the
              position or velocity object.