def params_from_locals(vlist, locvars):
    """Returns a dictionary where values in `vlist` are returned in a `dict`
    only if their values are not `None`.

    Args:
        vlist (list): of `str` variable names in `locvars`.
        locvars (dict): `locals()` dictionary from the requesting context.
    """
    result = {}
    for v in vlist:
        if v in locvars and locvars[v] is not None:
            result[v] = locvars[v]
    return result
