def get_value(fields, fieldname):
    """Get the value of a field from a nested dict.

    Parameters
    ----------
    fields : dict
        The nested dict.
    fieldname : str
        The name of the field. For nested fields, the name is of the form
        `a.b.c`, which corresponds to `fields['a']['b']['c']`.

    Returns
    -------
    The value.
    """

    keys = fieldname.split(".")
    value = fields
    for k in keys:
        if value is None:
            return
        value = value.get(k)
    return value