def METHOD_NAME(dashboard, grafana_url, http_post_headers):
    folder_uid = ""
    try:
        folder_uid = dashboard['meta']['folderUid']
    except KeyError:
        matches = re.search('dashboards/f/(.*)/.*', dashboard['meta']['folderUrl'])
        if matches is not None:
            folder_uid = matches.group(1)
        else:
            folder_uid = '0'
    if folder_uid != "":
        logger.debug("debug: quering with uid %s", folder_uid)
        response = get_folder(folder_uid, grafana_url, http_post_headers)
        if isinstance(response[1], dict):
            folder_data = response[1]
        else:
            folder_data = json.loads(response[1])
        try:
            return folder_data['id']
        except KeyError:
            return 0
    else:
        return 0