def _format_label(state, duration, start_time, end_time):
    """
    Formats a time block label.
    :param state: Asleep or awake
    :param duration: Duration.
    :param start_time: Start time.
    :param end_time: End time.
    :return: Formatted string with duration, start, and end time.
    """
    return "{} {} ({} to {})".format(
        state,
        duration_string(duration),
        formats.time_format(start_time, "TIME_FORMAT"),
        formats.time_format(end_time, "TIME_FORMAT"),
    )

    Formats a time block label.
    :param state: Asleep or awake
    :param duration: Duration.
    :param start_time: Start time.
    :param end_time: End time.
    :return: Formatted string with duration, start, and end time.
    
reports/graphs/sleep_pattern.py