<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_fieldset_index(fieldsets, index_or_name):
 """ Return the index of a fieldset in the ``fieldsets`` list. Args: fieldsets (list):
 The original ``fieldsets`` list. index_or_name (int or str):
 The value of the reference element, or directly its numeric index. Returns: (int) The index of the fieldset in the ``fieldsets`` list. """

    if isinstance(index_or_name, six.integer_types):
        return index_or_name

    for key, value in enumerate(fieldsets):
        if value[0] == index_or_name:
            return key

    raise KeyError("Key not found: '{}'.".format(index_or_name))