def batch_size(batch):
 size = 0
 for mutation in batch:
  size += len(mutation['key'])
  if ('values' in mutation):
   for value in mutation['values'].values():
    size += len(value)
 return size

def batch_size ( batch ) : size = 0 for mutation in batch : size += len ( mutation [ 'key' ] ) if ( 'values' in mutation ) : for value in mutation [ 'values' ] . values ( ) : size += len ( value ) return size
calculates the size of a batch .