'Extracts field data if this PDF contains interactive form fields.
The *tree* and *retval* parameters are for recursive use.
:param fileobj: A file object (usually a text file) to write
a report to on all interactive form fields found.
:return: A dictionary where each key is a field name, and each
value is a :class:`Field<PyPDF2.generic.Field>` object. By
default, the mapping name is used for keys.
:rtype: dict, or ``None`` if form data could not be located.'

def getFields(self, tree=None, retval=None, fileobj=None):

    fieldAttributes = {'/FT': 'Field    Type', '/Parent': 'Parent', '/T': 'Field    Name', '/TU': 'Alternate    Field    Name', '/TM': 'Mapping    Name', '/Ff': 'Field    Flags', '/V': 'Value', '/DV': 'Default    Value'}
    if (retval == None):
        retval = {}
        catalog = self.trailer['/Root']
        if ('/AcroForm' in catalog):
            tree = catalog['/AcroForm']
        else:
            return None
    if (tree == None):
        return retval
    self._checkKids(tree, retval, fileobj)
    for attr in fieldAttributes:
        if (attr in tree):
            self._buildField(tree, retval, fileobj, fieldAttributes)
            break
    if ('/Fields' in tree):
        fields = tree['/Fields']
        for f in fields:
            field = f.getObject()
            self._buildField(field, retval, fileobj, fieldAttributes)
    return retval
