'Transform data to API.ai format.'

def normalise_response_json(self, data):

    entities = {entity_type: [] for entity_type in set([x[u'entity'] for x in data[u'entities']])}
    for entity in data[u'entities']:
        entities[entity[u'entity']].append(entity[u'value'])
    return {u'id': str(uuid.uuid1()), u'timestamp': datetime.now().isoformat(), u'result': {u'source': u'agent', u'resolvedQuery': data[u'text'], u'action': None, u'actionIncomplete': None, u'parameters': entities, u'contexts': [], u'metadata': {u'intentId': str(uuid.uuid1()), u'webhookUsed': u'false', u'intentName': data[u'intent']}, u'fulfillment': {}, u'score': None}, u'status': {u'code': 200, u'errorType': u'success'}, u'sessionId': str(uuid.uuid1())}
