'Get the label for a field
@param rfield: the S3ResourceField
@param fact_options: the corresponding subset of the report
options ("fact", "rows" or "cols")'

@staticmethod
def _get_field_label(rfield, fact_options=None):

    label = None
    if (not rfield):
        return
    resource = rfield.resource
    fields = (list(fact_options) if fact_options else [])
    list_fields = resource.get_config('list_fields')
    if list_fields:
        fields.extend(list_fields)
    prefix = resource.prefix_selector
    selector = prefix(rfield.selector)
    for f in fields:
        if ((type(f) is tuple) and isinstance(f[1], basestring) and (prefix(f[1]) == selector)):
            label = f[0]
            break
    if ((not label) and rfield):
        if (rfield.ftype == 'id'):
            label = current.T('Records')
        else:
            label = rfield.label
    return (label if label else '')
