def build_run_cmd(raw_cmd, start_date=None, end_date=None, database=None):
    """Replace placeholder inputs in the model command with given values.

    Parameters
    ----------
    raw_cmd : str
        Raw command, whichs hould contain placeholders <start_date>, <end_date> and
        <database>.
    start_date : str or datetime.datetimie , optional
        Dataset start date to pass to command (metrics script should use this to modify
        database queries to return data restricted to the given date range), by default
        None
    end_date : str or datetime.datetime , optional
        Dataset end date to pass to command (metrics script should use this to modify
        database queries to return data restricted to the given date range), by default
        None
    database : str, optional
        Name of the database to pass to command (metrics script should use this to
        modify the database it connects to), by default None

    Returns
    -------
    str
        Command to run with at least one of the <start_date>, <end_date> and <database>
        placeholders, to be replaced by the input values.

    Raises
    ------
    ValueError
        If raw_cmd does not contain at least one of the <start_date>, <end_date> and
        <database> placeholders.
    """
    placeholders = {
        "<start_date>": start_date,
        "<end_date>": end_date,
        "<database>": database,
    }

    no_placeholders_found = True
    for key, value in placeholders.items():
        if key in raw_cmd and value is None:
            raise ValueError(f"No value given for {key}")
        else:
            no_placeholders_found = False
            raw_cmd = raw_cmd.replace(key, str(value))

    if no_placeholders_found:
        raise ValueError(
            "Command doesn't include any of the possible placeholders: "
            f"{list(placeholders.keys())}"
        )

    return raw_cmd