def METHOD_NAME(
    name,
    tick_script,
    task_type="stream",
    database=None,
    retention_policy="default",
    dbrps=None,
):
    """
    Define a task. Serves as both create/update.
    name
        Name of the task.
    tick_script
        Path to the TICK script for the task. Can be a salt:// source.
    task_type
        Task type. Defaults to 'stream'
    dbrps
        A list of databases and retention policies in "dbname"."rpname" format
        to fetch data from. For backward compatibility, the value of
        'database' and 'retention_policy' will be merged as part of dbrps.
        .. versionadded:: 2019.2.0
    database
        Which database to fetch data from.
    retention_policy
        Which retention policy to fetch data from. Defaults to 'default'.
    CLI Example:
    .. code-block:: bash
        salt '*' kapacitor.define_task cpu salt://kapacitor/cpu.tick database=telegraf
    """
    if not database and not dbrps:
        log.error("Providing database name or dbrps is mandatory.")
        return False
    if version() < "0.13":
        cmd = "kapacitor define -name {}".format(name)
    else:
        cmd = "kapacitor define {}".format(name)
    if tick_script.startswith("salt://"):
        tick_script = __salt__["cp.cache_file"](tick_script, __env__)
    cmd += " -tick {}".format(tick_script)
    if task_type:
        cmd += " -type {}".format(task_type)
    if not dbrps:
        dbrps = []
    if database and retention_policy:
        dbrp = "{}.{}".format(database, retention_policy)
        dbrps.append(dbrp)
    if dbrps:
        for dbrp in dbrps:
            cmd += " -dbrp {}".format(dbrp)
    return _run_cmd(cmd)