




'''simple docstring'''




def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      list[list[int]]       ):
 '''simple docstring'''





 UpperCAmelCase__										=    [list(SCREAMING_SNAKE_CASE__       ) for row in matrix]
 if matrix and isinstance(SCREAMING_SNAKE_CASE__       ,						SCREAMING_SNAKE_CASE__       ):
  if isinstance(matrix[0]       ,						SCREAMING_SNAKE_CASE__       ):
   UpperCAmelCase__										=    0
   for row in matrix:
    if prev_len == 0:
     UpperCAmelCase__										=    len(SCREAMING_SNAKE_CASE__       )
     UpperCAmelCase__										=    True
    else:
     UpperCAmelCase__										=    prev_len == len(SCREAMING_SNAKE_CASE__       )
  else:
   UpperCAmelCase__										=    True
 else:
  UpperCAmelCase__										=    False

 return result

def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      list[list[int]]       ):
 '''simple docstring'''





 if check_matrix(SCREAMING_SNAKE_CASE__       ) and len(SCREAMING_SNAKE_CASE__       ) > 0:
  UpperCAmelCase__										=    [list(SCREAMING_SNAKE_CASE__       ) for row in a]
  UpperCAmelCase__										=    len(SCREAMING_SNAKE_CASE__       )
  if isinstance(a[0]       ,						SCREAMING_SNAKE_CASE__       ):
   UpperCAmelCase__										=    len(a[0]       )
  else:
   for dat in a:
    print(SCREAMING_SNAKE_CASE__       )
   return

  # horizotal printing increasing
  for i in range(0       ,						SCREAMING_SNAKE_CASE__       ):
   print(a[0][i]       )
  # vertical printing down
  for i in range(1       ,						SCREAMING_SNAKE_CASE__       ):
   print(a[i][mat_col - 1]       )
  # horizotal printing decreasing
  if mat_row > 1:
   for i in range(mat_col - 2       ,						-1       ,						-1       ):
    print(a[mat_row - 1][i]       )
        # vertical printing up
  for i in range(mat_row - 2       ,						0       ,						-1       ):
   print(a[i][0]       )
  UpperCAmelCase__										=    [row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
  if len(SCREAMING_SNAKE_CASE__       ) > 0:
   spiral_print_clockwise(SCREAMING_SNAKE_CASE__       )
  else:
   return
 else:
  print("""Not a valid matrix"""       )
  return

def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      list[list]       ):
 '''simple docstring'''





 if matrix:
  return list(matrix.pop(0       )       ) + spiral_traversal(list(zip(*SCREAMING_SNAKE_CASE__       )       )[::-1]       )
 else:
  return []


# driver code
if __name__ == "__main__":
    import doctest

    doctest.testmod()

    UpperCAmelCase_       				=      [[1, 2, 3, 4], [5, 6, 7, 8], [9, 1_0, 1_1, 1_2]]
    spiral_print_clockwise(a)






'''simple docstring'''




from collections import namedtuple

UpperCAmelCase_       				=      namedtuple('from_to', 'from_ to')

UpperCAmelCase_       				=      {
    'millimeter': 'mm',
    'centimeter': 'cm',
    'meter': 'm',
    'kilometer': 'km',
    'inch': 'in',
    'inche': 'in',  # Trailing 's' has been stripped off
    'feet': 'ft',
    'foot': 'ft',
    'yard': 'yd',
    'mile': 'mi',
}

UpperCAmelCase_       				=      {
    'mm': from_to(0.001, 1_0_0_0),
    'cm': from_to(0.01, 1_0_0),
    'm': from_to(1, 1),
    'km': from_to(1_0_0_0, 0.001),
    'in': from_to(0.0254, 39.3701),
    'ft': from_to(0.3048, 3.2_8084),
    'yd': from_to(0.9144, 1.0_9361),
    'mi': from_to(1609.34, 0.0_0062_1371),
}

def    _UpperCamelCase      (				SCREAMING_SNAKE_CASE__			:      float       ,						SCREAMING_SNAKE_CASE__			:      str       ,						SCREAMING_SNAKE_CASE__			:      str       ):
 '''simple docstring'''





 UpperCAmelCase__										=    from_type.lower().rstrip("""s"""       )
 UpperCAmelCase__										=    TYPE_CONVERSION.get(SCREAMING_SNAKE_CASE__       ,						SCREAMING_SNAKE_CASE__       )
 UpperCAmelCase__										=    to_type.lower().rstrip("""s"""       )
 UpperCAmelCase__										=    TYPE_CONVERSION.get(SCREAMING_SNAKE_CASE__       ,						SCREAMING_SNAKE_CASE__       )
 if new_from not in METRIC_CONVERSION:
  UpperCAmelCase__										=    (
      F'''Invalid \'from_type\' value: {from_type!r}.\n'''
      F'''Conversion abbreviations are: {', '.join(SCREAMING_SNAKE_CASE__       )}'''
  )
  raise ValueError(SCREAMING_SNAKE_CASE__       )
 if new_to not in METRIC_CONVERSION:
  UpperCAmelCase__										=    (
      F'''Invalid \'to_type\' value: {to_type!r}.\n'''
      F'''Conversion abbreviations are: {', '.join(SCREAMING_SNAKE_CASE__       )}'''
  )
  raise ValueError(SCREAMING_SNAKE_CASE__       )
 return value * METRIC_CONVERSION[new_from].from_ * METRIC_CONVERSION[new_to].to


if __name__ == "__main__":
    import doctest

    doctest.testmod()
