def assert_angle(name, q):
    """
    Check that ``q`` is an angular `~astropy.units.Quantity`.
    """
    if isinstance(q, u.Quantity):
        if q.unit.physical_type == 'angle':
            pass
        else:
            raise ValueError("{0} should have angular units".format(name))
    else:
        raise TypeError("{0} should be a Quantity instance".format(name))
Check that ``q`` is an angular `~astropy.units.Quantity`.