def parse_request_data(request):
 try:
  data = json.loads((request.body or '{}'))
 except ValueError:
  raise ValueError(_('The record is not in the correct format. Please add a valid username or email address.'))
 return data

def parse_request_data ( request ) : try : data = json . loads ( ( request . body or '{}' ) ) except ValueError : raise ValueError ( _ ( 'The record is not in the correct format. Please add a valid username or email address.' ) ) return data
parse and return request data .