def writes_models(model):
def decorated(func):<EOL><INDENT>"""<STR_LIT>"""<EOL>_WRITE_MODEL[model] = func<EOL>return func<EOL><DEDENT>return decorated<EOL>
Register a model-specific create and update function.

This can then be accessed via the steps:

.. code-block:: gherkin

    And I have foos in the database:
        | name | bar  |
        | Baz  | Quux |

    And I update existing foos by pk in the database:
        | pk | name |
        | 1  | Bar  |

A method for a specific model can define a function ``write_badgers(data,
field)``, which creates and updates the Badger model and decorating it with
the ``writes_models(model_class)`` decorator:

.. code-block:: python

    @writes_models(Profile)
    def write_profile(data, field):
        '''Creates a Profile model'''

        for hash_ in data:
            if field:
                profile = Profile.objects.get(**{field: hash_[field]})
            else:
                profile = Profile()

            ...

        reset_sequence(Profile)

The function must accept a list of data hashes and a field name. If field
is not None, it is the field that must be used to get the existing objects
out of the database to update them; otherwise, new objects must be created
for each data hash.

Follow up model creation with a call to :func:`reset_sequence` to
update the database sequences.

If you only want to modify the hash, you can make modifications and then
pass it on to :func:`write_models`.

.. code-block:: python

    @writes_models(Profile)
    def write_profile(data, field):
        '''Creates a Profile model'''

        for hash_ in data:

            # modify hash

        return write_models(Profile, data, field)