'Options-field constructor
@param tablename: the table name
@param row: the s3_field Row
@return: the Field instance'

@staticmethod
def _options_field(tablename, row):

    fieldname = row.name
    fieldtype = row.field_type
    fieldopts = row.options
    settings = (row.settings or {})
    translate = settings.get('translate_options', True)
    T = current.T
    from s3utils import s3_str
    sort = False
    zero = ''
    if isinstance(fieldopts, dict):
        options = fieldopts
        if translate:
            options = dict(((k, T(v)) for (k, v) in options.items()))
        options_dict = options
        sort = settings.get('sort_options', True)
    elif isinstance(fieldopts, list):
        options = []
        for opt in fieldopts:
            if (isinstance(opt, (tuple, list)) and (len(opt) >= 2)):
                (k, v) = opt[:2]
            else:
                (k, v) = (opt, s3_str(opt))
            if translate:
                v = T(v)
            options.append((k, v))
        options_dict = dict(options)
        sort = settings.get('sort_options', False)
    else:
        options_dict = options = {}
    default = row.default_value
    if (default and (s3_str(default) in (s3_str(k) for k in options_dict))):
        zero = (None if row.require_not_empty else '')
    else:
        default = None
    len_options = len(options)
    if (len_options < 4):
        widget = (lambda field, value: SQLFORM.widgets.radio.widget(field, value, cols=len_options))
    else:
        widget = None
    from s3fields import S3Represent
    field = Field(fieldname, fieldtype, default=default, represent=S3Represent(options=options_dict, translate=translate), requires=IS_IN_SET(options, sort=sort, zero=zero), widget=widget)
    return field
