import base64
import json


def get_message(event):
    """Gets message from Cloud Function event

    Parameters
    ----------
    event : dict
        A GCP Cloud Function event.

    Returns
    -------
    str
        The message or empy string if no data
  
    """
    pubsub_message = base64.b64decode(event['data']).decode("utf-8")
    pubsub_data = json.loads(pubsub_message.replace("\'", "\""))
    
    if isinstance(pubsub_data, dict) and 'job' in pubsub_data:
        return pubsub_data['job']
    
    return ""