def dict_get(inp, *subfields):
    """Find the value of the provided sequence of keys in the dictionary,
    if available.

    Retrieve the value of the dictionary in a sequence of keys if it is
    available. Otherwise it provides as default value the last item of the
    sequence ``subfields``.

    Args:
       inp (dict): the top-level dictionary. Unchanged on exit.
       subfields (str,object): keys, ordered by level, that have to be
           retrieved from topmost level of ``inp``. The last item correspond
           to the value to be set.

    Returns:
       The value provided by the sequence of subfields if available,
       otherwise the default value given as the last item of the ``subfields``
       sequence.

    """
    if len(subfields) <= 1:
        raise ValueError('invalid subfields, the sequence should be longer than one item as the last one is the value to be given')
    tmp = inp
    keys = subfields[:-1]
    val = subfields[-1]
    for key in keys:
        tmp = tmp.get(key)
        if tmp is None:
            return val
    return tmp