def METHOD_NAME(self, query, user):
    logger.debug("Metrica is about to execute query: %s", query)
    data = None
    query = query.strip()
    if query == "":
        error = "Query is empty"
        return data, error
    try:
        params = yaml.safe_load(query)
    except ValueError as e:
        logging.exception(e)
        error = str(e)
        return data, error
    if isinstance(params, dict):
        if "url" in params:
            params = parse_qs(urlparse(params["url"]).query, keep_blank_values=True)
    else:
        error = "The query format must be JSON or YAML"
        return data, error
    try:
        data = json_dumps(parse_ym_response(self._send_query(**params)))
        error = None
    except Exception as e:
        logging.exception(e)
        error = str(e)
    return data, error