def insert_tag(el, add, before=True):
    """Insert element ('add') before or after element ('el').

    See `process.gen.add_hr` for doctest example.
    """
    parent = el.getparent()
    assert parent is not None
    num = parent.index(el)
    if not before:
        num = num + 1
    parent.insert(num, add)
