def ensure_coord_type(f):
    """
    A decorator for class methods of the form

    .. code-block:: python

        Class.method(self, coords, **kwargs)

    where ``coords`` is an :obj:`astropy.coordinates.SkyCoord` object.

    The decorator raises a :obj:`TypeError` if the ``coords`` that gets passed to
    ``Class.method`` is not an :obj:`astropy.coordinates.SkyCoord` instance.

    Args:
        f (class method): A function with the signature
            ``(self, coords, **kwargs)``, where ``coords`` is a :obj:`SkyCoord`
            object containing an array.

    Returns:
        A function that raises a :obj:`TypeError` if ``coords`` is not an
        :obj:`astropy.coordinates.SkyCoord` object, but which otherwise behaves
        the same as the decorated function.
    """
    @wraps(f)
    def _wrapper_func(self, coords, **kwargs):
        if not isinstance(coords, coordinates.SkyCoord):
            raise TypeError('`coords` must be an astropy.coordinates.SkyCoord object.')
        return f(self, coords, **kwargs)
    return _wrapper_func
A decorator for class methods of the form

    .. code-block:: python

        Class.method(self, coords, **kwargs)

    where ``coords`` is an :obj:`astropy.coordinates.SkyCoord` object.

    The decorator raises a :obj:`TypeError` if the ``coords`` that gets passed to
    ``Class.method`` is not an :obj:`astropy.coordinates.SkyCoord` instance.

    Args:
        f (class method): A function with the signature
            ``(self, coords, **kwargs)``, where ``coords`` is a :obj:`SkyCoord`
            object containing an array.

    Returns:
        A function that raises a :obj:`TypeError` if ``coords`` is not an
        :obj:`astropy.coordinates.SkyCoord` object, but which otherwise behaves
        the same as the decorated function.