<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_field_choices(self, field, field_name):
 """ Returns the valid choices for ``field``. The ``field_name`` argument is given for convenience. """

        if self.request.GET.get('select2'):
            names = ['id', 'text']
        else:
            names = ['value', 'text']
        choices_getter = getattr(self, 'get_field_%s_choices', None)
        if choices_getter is None:
            if isinstance(field, ForeignKey):
                choices_getter = self._get_foreignkey_choices
            else:
                choices_getter = self._get_default_choices
        return [dict(zip(names, choice)) for choice in choices_getter(field, field_name)]