def _convert_unit(unit):
    """Convert different names into SI units.

    Parameters
    ----------
    unit : str
        unit to convert to SI

    Returns
    -------
    str
        unit in SI format.

    Notes
    -----
    SI unit such as mV (milliVolt, mVolt), μV (microVolt, muV).

    """
    if unit is None:
        return ''

    prefix = None
    suffix = None
    if unit[:5].lower() == 'milli':
        prefix = 'm'
        unit = unit[5:]
    elif unit[:5].lower() == 'micro':
        prefix = mu
        unit = unit[5:]
    elif unit[:2].lower() == 'mu':
        prefix = mu
        unit = unit[2:]

    if unit[-4:].lower() == 'volt':
        suffix = 'V'
        unit = unit[:-4]

    if prefix is None and suffix is None:
        unit = unit
    elif prefix is None and suffix is not None:
        unit = unit + suffix
    elif prefix is not None and suffix is None:
        unit = prefix + unit
    else:
        unit = prefix + suffix

    return unit
def _convert_unit ( unit ) : if unit is None : return '' prefix = None suffix = None if unit [ : 5 ] . lower ( ) == 'milli' : prefix = 'm' unit = unit [ 5 : ] elif unit [ : 5 ] . lower ( ) == 'micro' : prefix = mu unit = unit [ 5 : ] elif unit [ : 2 ] . lower ( ) == 'mu' : prefix = mu unit = unit [ 2 : ] if unit [ - 4 : ] . lower ( ) == 'volt' : suffix = 'V' unit = unit [ : - 4 ] if prefix is None and suffix is None : unit = unit elif prefix is None and suffix is not None : unit = unit + suffix elif prefix is not None and suffix is None : unit = prefix + unit else : unit = prefix + suffix return unit
Convert different names into SI units.

    Parameters
    ----------
    unit : str
        unit to convert to SI

    Returns
    -------
    str
        unit in SI format.

    Notes
    -----
    SI unit such as mV (milliVolt, mVolt), μV (microVolt, muV).