def METHOD_NAME(
    name,
    type,
    url,
    access="proxy",
    user="",
    password="",
    database="",
    basic_auth=False,
    basic_auth_user="",
    basic_auth_password="",
    is_default=False,
    json_data=None,
    profile="grafana",
):
    """
    Ensure that a data source is present.
    name
        Name of the data source.
    type
        Which type of data source it is ('graphite', 'influxdb' etc.).
    url
        The URL to the data source API.
    user
        Optional - user to authenticate with the data source
    password
        Optional - password to authenticate with the data source
    basic_auth
        Optional - set to True to use HTTP basic auth to authenticate with the
        data source.
    basic_auth_user
        Optional - HTTP basic auth username.
    basic_auth_password
        Optional - HTTP basic auth password.
    is_default
        Default: False
    """
    if isinstance(profile, str):
        profile = __salt__["config.option"](profile)
    ret = {"name": name, "result": None, "comment": None, "changes": {}}
    datasource = _get_datasource(profile, name)
    data = _get_json_data(
        name,
        type,
        url,
        access,
        user,
        password,
        database,
        basic_auth,
        basic_auth_user,
        basic_auth_password,
        is_default,
        json_data,
    )
    if datasource:
        requests.put(
            _get_url(profile, datasource["id"]),
            data,
            headers=_get_headers(profile),
            timeout=profile.get("grafana_timeout", 3),
        )
        ret["result"] = True
        ret["changes"] = _diff(datasource, data)
        if ret["changes"]["new"] or ret["changes"]["old"]:
            ret["comment"] = "Data source {} updated".format(name)
        else:
            ret["changes"] = {}
            ret["comment"] = "Data source {} already up-to-date".format(name)
    else:
        requests.post(
            "{}/api/datasources".format(profile["grafana_url"]),
            data,
            headers=_get_headers(profile),
            timeout=profile.get("grafana_timeout", 3),
        )
        ret["result"] = True
        ret["comment"] = "New data source {} added".format(name)
        ret["changes"] = data
    return ret