def GetRequestFormatMode(request, method_metadata):
 if request.path.startswith('/api/v2/'):
  return JsonMode.PROTO3_JSON_MODE
 if (hasattr(request, 'GET') and request.GET.get('strip_type_info', '')):
  return JsonMode.GRR_TYPE_STRIPPED_JSON_MODE
 for (http_method, unused_url, options) in method_metadata.http_methods:
  if ((http_method == request.method) and options.get('strip_root_types', False)):
   return JsonMode.GRR_ROOT_TYPES_STRIPPED_JSON_MODE
 return JsonMode.GRR_JSON_MODE

def GetRequestFormatMode ( request , method_metadata ) : if request . path . startswith ( '/api/v2/' ) : return JsonMode . PROTO3_JSON_MODE if ( hasattr ( request , 'GET' ) and request . GET . get ( 'strip_type_info' , '' ) ) : return JsonMode . GRR_TYPE_STRIPPED_JSON_MODE for ( http_method , unused_url , options ) in method_metadata . http_methods : if ( ( http_method == request . method ) and options . get ( 'strip_root_types' , False ) ) : return JsonMode . GRR_ROOT_TYPES_STRIPPED_JSON_MODE return JsonMode . GRR_JSON_MODE
returns json format mode corresponding to a given request and method .