'Convert python-style fields definitions to rdfvalue-based definitions.'

@staticmethod
def FieldsToFieldsDefinitions(fields):

    if (not fields):
        return []
    result = []
    for (field_name, field_type) in fields:
        if (field_type in (int, long)):
            field_type = MetricFieldDefinition.FieldType.INT
        elif (field_type == str):
            field_type = MetricFieldDefinition.FieldType.STR
        else:
            raise ValueError(('Unknown    field    type:    %s' % field_type))
        result.append(MetricFieldDefinition(field_name=field_name, field_type=field_type))
    return result
