def groupkey_to_pairs(groupkey, term):
    """
    Convert a 'groupkey', a structure defined below in 'lookup_grouped_by_feature',
    to a list of pairs representing the parameters that query for just the
    edges in that feature group.
    """
    direction, rel = groupkey
    if direction == 1:
        return [('rel', rel), ('start', term)]
    elif direction == -1:
        return [('rel', rel), ('end', term)]
    else:
        return [('rel', rel), ('node', term)]