human
Complete the below
def build_rule(table='filter', chain=None, command=None, position='', full=None, family='ipv4', **kwargs):

    ''''Build a well-formatted iptables rule based on kwargs. A `table` and `chain`
    are not required, unless `full` is True.
    If `full` is `True`, then `table`, `chain` and `command` are required.
    `command` may be specified as either a short option (\'I\') or a long option
    (`--insert`). This will return the iptables command, exactly as it would
    be used from the command line.
    If a position is required (as with `-I` or `-D`), it may be specified as
    `position`. This will only be useful if `full` is True.
    If `state` is passed, it will be ignored, use `connstate`.
    If `connstate` is passed in, it will automatically be changed to `state`.
    To pass in jump options that doesn\'t take arguments, pass in an empty
    string.
    CLI Examples:
    .. code-block:: bash
    salt \'*\' iptables.build_rule match=state \
    connstate=RELATED,ESTABLISHED jump=ACCEPT
    salt \'*\' iptables.build_rule filter INPUT command=I position=3 \
    full=True match=state connstate=RELATED,ESTABLISHED jump=ACCEPT
    salt \'*\' iptables.build_rule filter INPUT command=A \
    full=True match=state connstate=RELATED,ESTABLISHED \
    source=\'127.0.0.1\' jump=ACCEPT
    .. Invert Rules
    salt \'*\' iptables.build_rule filter INPUT command=A \
    full=True match=state connstate=RELATED,ESTABLISHED \
    source=\'!127.0.0.1\' jump=ACCEPT
    salt \'*\' iptables.build_rule filter INPUT command=A \
    full=True match=state connstate=RELATED,ESTABLISHED \
    destination=\'not 127.0.0.1\' jump=ACCEPT
    IPv6:
    salt \'*\' iptables.build_rule match=state \
    connstate=RELATED,ESTABLISHED jump=ACCEPT \
    family=ipv6
    salt \'*\' iptables.build_rule filter INPUT command=I position=3 \
    full=True match=state connstate=RELATED,ESTABLISHED jump=ACCEPT \
    family=ipv6'
    '''

=====
What is a the Python code you requested?
assistant
#Here is the Python code you requested.
    if ('target' in kwargs):
        kwargs['jump'] = kwargs.pop('target')
    kwargs.pop('name', None)
    kwargs.pop('state', None)
    for ignore in (list(_STATE_INTERNAL_KEYWORDS) + ['chain', 'save', 'table']):
        if (ignore in kwargs):
            del kwargs[ignore]
    rule = []
    proto = False
    bang_not_pat = re.compile('(!|not)\\s?')
    def maybe_add_negation(arg):
        "\n                                Will    check    if    the    defined    argument    is    intended    to    be    negated,\n                                (i.e.    prefixed    with    '!'    or    'not'),    and    add    a    '!    '    to    the    rule.\n\n                                The    prefix    will    be    removed    from    the    value    in    the    kwargs    dict.\n                                "
        value = str(kwargs[arg])
        if (value.startswith('!') or value.startswith('not')):
            kwargs[arg] = re.sub(bang_not_pat, '', value)
            return '!    '
        return ''
    if ('if' in kwargs):
        rule.append('{0}-i    {1}'.format(maybe_add_negation('if'), kwargs['if']))
        del kwargs['if']
    if ('of' in kwargs):
        rule.append('{0}-o    {1}'.format(maybe_add_negation('of'), kwargs['of']))
        del kwargs['of']
    for proto_arg in ('protocol', 'proto'):
        if (proto_arg in kwargs):
            if (not proto):
                rule.append('{0}-p    {1}'.format(maybe_add_negation(proto_arg), kwargs[proto_arg]))
                proto = True
            del kwargs[proto_arg]
    if ('match' in kwargs):
        match_value = kwargs['match']
        if (not isinstance(match_value, list)):
            match_value = match_value.split(',')
        for match in match_value:
            rule.append('-m    {0}'.format(match))
            if (('name_' in kwargs) and (match.strip() in ('pknock', 'quota2', 'recent'))):
                rule.append('--name    {0}'.format(kwargs['name_']))
                del kwargs['name_']
        del kwargs['match']
    if...