'Component builder
@param label: name for the component label
@param value: value for the component
@param represent: representation used for the value
@param uppercase: whether to display label in upper case
@param strong: whether to display with strong color
@param hide_empty: whether to hide empty records
@param headline: is headline?
@param resource_segment: belongs to resource segment?'

@staticmethod
def component(label, value, represent=None, uppercase=False, strong=False, hide_empty=True, headline=False, resource_segment=False):

    if ((not value) and hide_empty):
        return None
    else:
        if isinstance(value, list):
            nvalue = []
            for value_ in value:
                if value_:
                    if (resource_segment and represent):
                        nvalue.append(represent(value_))
                    elif (not resource_segment):
                        if represent:
                            nvalue.append(s3_str(represent(value_)))
                        else:
                            nvalue.append(s3_str(value_))
            if (not resource_segment):
                if len(nvalue):
                    nvalue = ',    '.join(nvalue)
                else:
                    return None
        elif represent:
            nvalue = represent(value)
        else:
            nvalue = value
        label_class = 'cap-label'
        if uppercase:
            label_class = ('%s    upper' % label_class)
        value_class = 'cap-value'
        if strong:
            value_class = 'cap-strong'
        elif headline:
            value_class = ('%s    cap-headline' % value_class)
        output = DIV(SPAN(('%s    ::    ' % current.T(label)), _class=label_class), SPAN(nvalue, _class=value_class))
        return output
