def _create_m2m_links_step(self, rel_model_name,
                           rel_key, rel_value, relation_name):
    """
    Link many-to-many models together.

    Syntax:

        And `model` with `field` "`value`" is linked to `other model` in the
        database:

    Example:

    .. code-block:: gherkin

        And article with name "Guidelines" is linked to tags in the database:
            | name   |
            | coding |
            | style  |
    """

    lookup = {rel_key: rel_value}
    rel_model = get_model(rel_model_name).objects.get(**lookup)
    relation = None
    for m2m in rel_model._meta.many_to_many:
        if relation_name in (m2m.name, m2m.verbose_name):
            relation = getattr(rel_model, m2m.name)
            break
    if not relation:
        try:
            relation = getattr(rel_model, relation_name)
        except AttributeError:
            pass
    assert relation, \
        "%s does not have a many-to-many relation named '%s'" % (
            rel_model._meta.verbose_name.capitalize(),
            relation_name,
        )
    m2m_model = relation.model

    for hash_ in self.hashes:
        relation.add(m2m_model.objects.get(**hash_))
Link many-to-many models together.

    Syntax:

        And `model` with `field` "`value`" is linked to `other model` in the
        database:

    Example:

    .. code-block:: gherkin

        And article with name "Guidelines" is linked to tags in the database:
            | name   |
            | coding |
            | style  |