def METHOD_NAME(deg, use_cache):
    if use_cache:
        for k in _saved_inverse_rotation_mats.keys():
            if abs(k - deg) < 5:
                return _saved_inverse_rotation_mats[k]
    # if it reaches here it means it had not calculated the degree before
    rotation = R.from_euler("xyz", [0, deg, 0], degrees=True)
    result = rotation.as_matrix()
    inverse = inverse_rot_trans_matrix(result)
    if use_cache:
        get_logger().warning(f"Had to calculate the matrix for {deg}")
    return inverse