@staticmethod
def _format_measure(measure):
    """Format measure to correct type."""
    try:
        measure = int(measure)
    except ValueError:
        try:
            if float(measure) < 10:
                measure = float('{:.2f}'.format(round(float(measure), 2)))
            else:
                measure = float('{:.1f}'.format(round(float(measure), 1)))
        except ValueError:
            if measure == 'on':
                measure = True
            elif measure == 'off':
                measure = False
    return measure
