def add_block_ids(payload):
 if ('data' in payload):
  for ele in payload['data']:
   if ('module_id' in ele):
    ele['block_id'] = UsageKey.from_string(ele['module_id']).block_id

def add_block_ids ( payload ) : if ( 'data' in payload ) : for ele in payload [ 'data' ] : if ( 'module_id' in ele ) : ele [ 'block_id' ] = UsageKey . from_string ( ele [ 'module_id' ] ) . block_id
rather than manually parsing block_ids from module_ids on the client .