expression : FIELD operation value

def p_expression_ID(p):
    """expression : FIELD operation value
    """
    lookup = compa2lookup[p[2]]

    try:
        field = get_shortcut(p[1])
    except KeyError:
        field = p[1]

    if lookup:
        field = '%s__%s' % (field, lookup)

    # In some situations (which ones?), python
    # refuses unicode strings as dict keys for
    # Q(**d)
    field = str(field)

    d = {field: p[3]}

    p[0] = Q(**d)