def parse_types():
    # Go through Types workbook

    types_sheet = workbook.sheet_by_name('Types')
    types = {}

    for row in range(1, types_sheet.nrows):
        row_values = [str(v).strip() if isinstance(v, (str, unicode)) else v \
                      for v in types_sheet.row_values(row, end_colx=4)]

        if not any(row_values):
            continue

        possible_type_name, possible_base_type, name, value = row_values

        if possible_type_name:
            type_name = possible_type_name
            base_type = possible_base_type

        if possible_type_name:
            # We define a type here
            types[type_name] = Type(type_name, base_type, {})

        elif name:
            if 'int' in base_type or base_type == 'enum':
                # Convert value to int if required
                if type(value) == float and value % 1 == 0.0:
                    value = int(value)

            types[type_name].values[value] = TypeValue(name, value)

    types.update(SPECIAL_TYPES)

    # Special considerations on types dict

    ## FOR NOW: skip mfg_range_min (0xFF00) and mfg_range_max (0xFFFE)
    for value in [v.value for v in types['mesg_num'].values.copy().itervalues()
                  if v.name in ('mfg_range_min', 'mfg_range_max')]:
        del types['mesg_num'].values[value]

    return types


### Go through Message workbook ###
dataset/ETHPy150Open dtcooper/python-fitparse/scripts/generate_profile.py/parse_types/original