Python Match Case Substring Method Definition Math