def add_data_field(self, name, i1, i2, subfields_dict):
if i1 not in self.valid_i_chars:<EOL><INDENT>raise ValueError("<STR_LIT>" + i1 + "<STR_LIT>")<EOL><DEDENT>if i2 not in self.valid_i_chars:<EOL><INDENT>raise ValueError("<STR_LIT>" + i2 + "<STR_LIT>")<EOL><DEDENT>if len(name) != <NUM_LIT:3>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not subfields_dict:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(subfields_dict, dict):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>subrecords = []<EOL>for key, val in subfields_dict.items():<EOL><INDENT>if len(key) > <NUM_LIT:1>:<EOL><INDENT>raise KeyError(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if not isinstance(val, list):<EOL><INDENT>val = [val]<EOL><DEDENT>subfields = map(<EOL>lambda x: MARCSubrecord(x, i1, i2, None),<EOL>val<EOL>)<EOL>subfields_dict[key] = subfields<EOL>subrecords.extend(subfields)<EOL><DEDENT>subfields_dict[self.i1_name] = i1<EOL>subfields_dict[self.i2_name] = i2<EOL>if name in self.datafields:<EOL><INDENT>self.datafields[name].append(subfields_dict)<EOL><DEDENT>else:<EOL><INDENT>self.datafields[name] = [subfields_dict]<EOL><DEDENT>other_subfields = self.datafields[name]<EOL>for record in subrecords:<EOL><INDENT>record.other_subfields = other_subfields<EOL><DEDENT>
Add new datafield into :attr:`datafields` and take care of OAI MARC
differencies.

Args:
    name (str): Name of datafield.
    i1 (char): Value of i1/ind1 parameter.
    i2 (char): Value of i2/ind2 parameter.
    subfields_dict (dict): Dictionary containing subfields (as list).

`subfields_dict` is expected to be in this format::

    {
        "field_id": ["subfield data",],
        ...
        "z": ["X0456b"]
    }

Warning:
    For your own good, use OrderedDict for `subfields_dict`, or
    constructor's `resort` parameter set to ``True`` (it is by
    default).

Warning:
    ``field_id`` can be only one character long!