def refix(val, p_in="", p_out=""):
    """

    Convert between different SI unit prefixes. Available options are:

    :code:`'T'`   Terra

    :code:`'G'` Giga

    :code:`'M'` Mega

    :code:`'k'` Kilo

    :code:`'m'` Milli

    :code:`'mu'` Micro

    :code:`'n'` Nano

    :code:`'p'` Pico

    Parameters
    ----------
    val: scalar
        The value for which to convert the unit prefix.
    p_in: string, any of the above, optional
        The current prefix of :code:`val`. If :code:`p_in` is undefined,
        :code:`val` has no SI unit prefix.
    p_out: string, any of the above, optional
        The prefix of :code:`val_refix` after the conversion.  If :code:`p_in`
        is undefined, :code:`val_refix` has no SI unit prefix.

    Returns
    -------
    val_refix: scalar
        The value in units of prefix :code:`p_out`.

    """
    prefix = {
        'p': 10 ** -12,
        'n': 10 ** -9,
        'mu': 10 ** -6,
        'm': 10 ** -3,
        '': 10 ** -0,
        'k': 10 ** 3,
        'M': 10 ** 6,
        'G': 10 ** 9,
        'T': 10 ** 12
    }
    val_refix = val * prefix[p_in] / prefix[p_out]
    return val_refix