def get_key_field(ui, ui_option_name, default_val=<NUM_LIT:0>, default_is_number=True):
key = default_val<EOL>key_is_field_number = default_is_number<EOL>if ui.optionIsSet(ui_option_name):<EOL><INDENT>key = ui.getValue(ui_option_name)<EOL>try:<EOL><INDENT>key = int(key) - <NUM_LIT:1><EOL>key_is_field_number = True<EOL><DEDENT>except ValueError:<EOL><INDENT>key_is_field_number = False<EOL><DEDENT><DEDENT>return key, key_is_field_number<EOL>
parse an option from a UI object as the name of a key field.

If the named option is not set, return the default values for the tuple.

:return: a tuple of two items, first is the value of the option, second is
         a boolean value that indicates whether the value is a column name
         or a column number (numbers start at 0).