def matrix_multiply_mapper(m, element):
 (matrix, i, j, value) = element
 if (matrix == 'A'):
  for column in range(m):
   (yield ((i, column), (j, value)))
 else:
  for row in range(m):
   (yield ((row, j), (i, value)))

def matrix_multiply_mapper ( m , element ) : ( matrix , i , j , value ) = element if ( matrix == 'A' ) : for column in range ( m ) : ( yield ( ( i , column ) , ( j , value ) ) ) else : for row in range ( m ) : ( yield ( ( row , j ) , ( i , value ) ) )
m is the common dimension element is a tuple .