def get_scenario_id_and_name(scenario_id_arg, scenario_name_arg, c, script):
    """
    Get the scenario_id and the scenario_ name. Usually only one is given (the
    other one will be 'None'), so this functions determine the missing one from
    the one that is provided. If both are provided, this function checks
    whether they match.

    :param scenario_id_arg:
    :param scenario_name_arg:
    :param c:
    :param script:
    :return: (scenario_id, scenario_name)
    """

    if scenario_id_arg is None and scenario_name_arg is None:
        raise TypeError(
            """ERROR: Either scenario_id or scenario_name must be specified. 
            Run 'python """ + script + """'.py --help' for help."""
        )

    elif scenario_id_arg is not None and scenario_name_arg is None:
        result = c.execute(
            """SELECT scenario_name
               FROM scenarios
               WHERE scenario_id = {};""".format(scenario_id_arg)
        ).fetchone()
        if result is None:
            raise ValueError(
                """ERROR: No matching scenario found for scenario_id '{}'"""
                .format(scenario_id_arg)
            )
        else:
            return scenario_id_arg, result[0]

    elif scenario_id_arg is None and scenario_name_arg is not None:
        result = c.execute(
            """SELECT scenario_id
               FROM scenarios
               WHERE scenario_name = '{}';""".format(scenario_name_arg)
        ).fetchone()
        if result is None:
            raise ValueError(
                """ERROR: No matching scenario found for scenario_name '{}'"""
                .format(scenario_name_arg)
            )
        else:
            return result[0], scenario_name_arg

    else:
        # If both scenario_id and scenario_name are specified
        result = c.execute(
            """SELECT scenario_name
               FROM scenarios
               WHERE scenario_id = {};""".format(scenario_id_arg)
        ).fetchone()
        if result is None:
            raise ValueError(
                """ERROR: No matching scenario found for scenario_id '{}'"""
                .format(scenario_id_arg)
            )
        elif result[0] != scenario_name_arg:
            raise ValueError(
                """ERROR: scenario_id and scenario_name don't match in 
                database."""
            )
        else:
            return scenario_id_arg, scenario_name_arg