'Get the associated function to execute for a triggered AWS event
Support S3, SNS, DynamoDB and kinesis events'

def get_function_for_aws_event(self, record):

    if (u's3' in record):
        return record[u's3'][u'configurationId'].split(u':')[(-1)]
    arn = None
    if (u'Sns' in record):
        try:
            message = json.loads(record[u'Sns'][u'Message'])
            if message.get(u'command'):
                return message[u'command']
        except ValueError:
            pass
        arn = record[u'Sns'].get(u'TopicArn')
    elif ((u'dynamodb' in record) or (u'kinesis' in record)):
        arn = record.get(u'eventSourceARN')
    if arn:
        return self.settings.AWS_EVENT_MAPPING.get(arn)
    return None
