def set_distance_units(value=np.NaN, from_units='<STR_LIT>', to_units='<STR_LIT>'):
if from_units == to_units:<EOL><INDENT>return value<EOL><DEDENT>if from_units == '<STR_LIT>':<EOL><INDENT>if to_units == '<STR_LIT>':<EOL><INDENT>coeff = <NUM_LIT:10><EOL><DEDENT>elif to_units == '<STR_LIT:m>':<EOL><INDENT>coeff = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>elif from_units == '<STR_LIT>':<EOL><INDENT>if to_units == '<STR_LIT>':<EOL><INDENT>coeff = <NUM_LIT:0.1><EOL><DEDENT>elif to_units == '<STR_LIT:m>':<EOL><INDENT>coeff = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>elif from_units == '<STR_LIT:m>':<EOL><INDENT>if to_units == '<STR_LIT>':<EOL><INDENT>coeff = <NUM_LIT:1000><EOL><DEDENT>elif to_units == '<STR_LIT>':<EOL><INDENT>coeff = <NUM_LIT:100><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return coeff * value<EOL>
convert distance into new units

    Parameters:
    ===========
    value: float. value to convert
    from_units: string. Must be 'mm', 'cm' or 'm'
    to_units: string. must be 'mm','cm' or 'm'

    Returns:
    ========
    converted value

    Raises:
    =======
    ValueError if from_units is not a valid unit (see above)
    ValueError if to_units is not a valid unit