def parse_unit(unit):
    """Parse a unit string

    Parameters
    ----------
    unit : str
        String describing a unit (e.g., 'mm')

    Returns
    -------
    factor : float
        Factor that relates the base unit to the parsed unit.
        E.g., `parse_unit('mm')[0] -> 1e-3`
    baseunit : str
        Physical unit without the prefix.
        E.g., `parse_unit('mm')[1] -> 'm'`

    """
    if unit is None or len(unit) == 0:
        return 1.
    unit_type = unit[-1]
    unit_scale = unit[:-1]
    mu1 = '\u00B5'
    mu2 = '\u03BC'
    unit_map = {'Y': 1E24, 'Z': 1E21, 'E': 1E18, 'P': 1E15, 'T': 1E12, 'G': 1E9,
                'M': 1E6, 'k': 1E3, 'h': 1e2, 'da': 1E1, 'd': 1E-1, 'c': 1E-2,
                'm': 1E-3, mu1: 1E-6, mu2: 1E-6, 'u': 1E-6, 'n': 1E-9,
                'p': 1E-12, 'f': 1E-15, 'a': 1E-18, 'z': 1E-21, 'y': 1E-24}
    if len(unit_scale) == 0:
        return 1., unit_type
    else:
        return unit_map[unit_scale], unit_type