code: def map_v2_event_into_v1(event):
      '''
      Helper method to convert Sensu 2.x event into Sensu 1.x event.
      '''
      if "v2_event_mapped_into_v1" in event:
          return event
      if not bool(event.get('client')) and "entity" in event:
          event['client'] = event['entity']
          if "name" not in event['client']:
              event['client']['name'] = event['entity']['id']
          if "subscribers" not in event['client']:
              event['client']['subscribers'] = event['entity']['subscriptions']
          if "subscribers" not in event['check']:
              event['check']['subscribers'] = event['check']['subscriptions']
          if "source" not in event['check']:
              event['check']['source'] = event['check']['proxy_entity_id']
          action_state_mapping = {'flapping': 'flapping', 'passing': 'resolve',
                                  'failing': 'create'}
          if "state" in event['check']:
              state = event['check']['state']
          else:
              state = "unknown::2.0_event"
          if "action" not in event and state.lower() in action_state_mapping:
              event['action'] = action_state_mapping[state.lower()]
          else:
              event['action'] = state
          if "history" in event['check']:
              event['check']['history_v2'] = deepcopy(event['check']['history'])
              legacy_history = []
              for history in event['check']['history']:
                  if isinstance(history['status'], int):
                      legacy_history.append(str(history['status']))
                  else:
                      legacy_history.append("3")
              event['check']['history'] = legacy_history
          event['v2_event_mapped_into_v1'] = True
      return event