

def get_message(data):
    '\n    Extract status and message from the given dictionary.\n    The message is translated according to the hash map.\n\n    :param data: status and message hash/key pair\n    :type data: dict\n    :returns: (success, message) tuple\n    '
    success = data['success']
    message = ''
    if success:
        if (('message' in data) and (len(data['message']) == 2)):
            hash_map = data['message'][0]
            message_code = data['message'][1]
            message = getattr(g, hash_map)(message_code)
    elif (('errors' in data) and (len(data['errors']) > 0)):
        error_tuple = data['errors'][0].get('code')
        if (error_tuple and (len(error_tuple) == 2)):
            hash_map = error_tuple[0]
            error_code = error_tuple[1]
            message = getattr(g, hash_map)(error_code)
    return (success, message)

dataset/ETHPy150Open Opentaste/bombolone/bombolone/core/utils/message.py get_message/original