def parse_angular_length_quantity(string_rep, unit=u.deg):
        """
        Given a string that is either a number or a number and a unit, return a
        Quantity of that string.  e.g.:

            23.9 -> 23.9*u.deg
            50" -> 50*u.arcsec
        """
        unit_mapping = {
            '"': u.arcsec,
            "'": u.arcmin,
            'd': u.deg,
            'r': u.rad,
            'i': u.dimensionless_unscaled,
            'p': u.dimensionless_unscaled
        }
        has_unit = string_rep[-1] not in string.digits
        if has_unit:
            unit = unit_mapping[string_rep[-1]]
            return u.Quantity(float(string_rep[:-1]), unit=unit)
        else:
            return u.Quantity(float(string_rep), unit=unit)
def parse_angular_length_quantity ( string_rep , unit = u . deg ) : unit_mapping = { '"' : u . arcsec , "'" : u . arcmin , 'd' : u . deg , 'r' : u . rad , 'i' : u . dimensionless_unscaled , 'p' : u . dimensionless_unscaled } has_unit = string_rep [ - 1 ] not in string . digits if has_unit : unit = unit_mapping [ string_rep [ - 1 ] ] return u . Quantity ( float ( string_rep [ : - 1 ] ) , unit = unit ) else : return u . Quantity ( float ( string_rep ) , unit = unit )
Given a string that is either a number or a number and a unit, return a
        Quantity of that string.  e.g.:

            23.9 -> 23.9*u.deg
            50" -> 50*u.arcsec