def _valvar(unk, vardict):
    """Determines if an unknown string is a value or a dict variable.

    Parameters
    ----------
    unk : float or str
        The unknown value, either a float or a dictionary key.
    vardict : dict
        The dictionary to be searched if unk is not a float.

    Returns
    -------
    float
        The desired value for unk.

    Raises
    ------
    ValueError
        When unk is not a float and not a key in vardict.
    """
    try:
        return float(unk)
    except ValueError:
        if unk in vardict:
            return vardict[unk]
        else:
            raise KeyError('\'{}\' not found in variable list'.format(unk))