def convert_length(length_from, length_to):
    """
    Determines the length scale factor

    We crate a gravity_scale_length for any non-standard unit (ft, m)

    """
    xyz_scale = 1.0
    gravity_scale_length = 1.0
    if length_from == 'in':
        xyz_scale *= 0.0254
        gravity_scale_length /= 12.0
    elif length_from == 'ft':
        xyz_scale *= 0.3048
    elif length_from == 'm':
        pass
    elif length_from == 'cm':
        xyz_scale *= 100.0
        gravity_scale_length /= 100.0
    elif length_from == 'mm':
        xyz_scale /= 1000.0
        gravity_scale_length /= 1000.0
    else:
        raise NotImplementedError(
            'length from unit=%r; expected=[in, ft, m, cm, mm]' % length_from)
    if length_to == 'in':
        xyz_scale /= 0.0254
        gravity_scale_length *= 12.0
    elif length_to == 'ft':
        xyz_scale /= 0.3048
    elif length_to == 'm':
        pass
    elif length_to == 'cm':
        xyz_scale /= 100.0
        gravity_scale_length *= 100.0
    elif length_to == 'mm':
        xyz_scale *= 1000.0
        gravity_scale_length *= 1000.0
    else:
        raise NotImplementedError(
            'length to unit=%r; expected=[in, ft, m, cm, mm]' % length_to)
    return xyz_scale, gravity_scale_length
