def _get_course_marketing_url(config, course):
    """
    Get the url for a course if any

    Args:
        config (OpenEdxConfiguration): configuration for the openedx backend
        course (dict): the data for the course

    Returns:
        str: The url for the course if any
    """
    for course_run in course.get("course_runs", []):
        url = course_run.get("marketing_url", "")
        if url and config.base_url in url:
            return url.split("?")[0]
    return None