code: def _apply(self, method, *args, **kwargs):
          
          if callable(method):
              apply_method = lambda array: method(array, *args, **kwargs)
          else:
              apply_method = operator.methodcaller(method, *args, **kwargs)
          return self.__class__([apply_method(getattr(self, component))
                                 for component in self.components], copy=False)
docs: Create a new representation with ``method`` applied to the arrays.
  
          In typical usage, the method is any of the shape-changing methods for
          `~numpy.ndarray` (``reshape``, ``swapaxes``, etc.), as well as those
          picking particular elements (``__getitem__``, ``take``, etc.), which
          are all defined in `~astropy.utils.misc.ShapedLikeNDArray`. It will be
          applied to the underlying arrays (e.g., ``x``, ``y``, and ``z`` for
          `~astropy.coordinates.CartesianRepresentation`), with the results used
          to create a new instance.
  
          Internally, it is also used to apply functions to the components
          (in particular, `~numpy.broadcast_to`).
  
          Parameters
          ----------
          method : str or callable
              If str, it is the name of a method that is applied to the internal
              ``components``. If callable, the function is applied.
          args : tuple
              Any positional arguments for ``method``.
          kwargs : dict
              Any keyword arguments for ``method``.