import ast


def _fields_of_2(a, b):
    """Return dict of fields of both nodes.

    Key is field name, value is a pair containing the field values for the 2
    nodes. If a field is missing on one node, None is used instead of the
    missing value.
    """
    ret = {}

    for f, v in ast.iter_fields(a):
        l = ret.setdefault(f, [None, None])
        l[0] = v

    for f, v in ast.iter_fields(b):
        l = ret.setdefault(f, [None, None])
        l[1] = v

    for k in ret:
        ret[k] = tuple(ret[k])

    return ret