# Buggy code
def _build_channels(self, schedule, channels_to_plot, t0, tf):
    # prepare waveform channels
    drive_channels = collections.OrderedDict()
    measure_channels = collections.OrderedDict()
    control_channels = collections.OrderedDict()
    acquire_channels = collections.OrderedDict()
    snapshot_channels = collections.OrderedDict()

    _channels = list(schedule.channels) + channels_to_plot
    _channels = list(set(_channels))

    for chan in _channels:
        if isinstance(chan, DriveChannel):
            try:
                drive_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, MeasureChannel):
            try:
                measure_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, ControlChannel):
            try:
                control_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, AcquireChannel):
            try:
                acquire_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, SnapshotChannel):
            try:
                snapshot_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass

    output_channels = {
        **drive_channels,
        **measure_channels,
        **control_channels,
        **acquire_channels,
    }
    channels = {**output_channels, **acquire_channels, **snapshot_channels}
    # sort by index then name to group qubits together.
    output_channels = collections.OrderedDict(
        sorted(output_channels.items(), key=lambda x: (x[0].index, x[0].name))
    )
    channels = collections.OrderedDict(
        sorted(channels.items(), key=lambda x: (x[0].index, x[0].name))
    )

    for start_time, instruction in schedule.instructions:
        for channel in instruction.channels:
            if channel in output_channels:
                output_channels[channel].add_instruction(start_time, instruction)
            elif channel in snapshot_channels:
                snapshot_channels[channel].add_instruction(start_time, instruction)
    return channels, output_channels, snapshot_channels


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-5df9debb5295> in <module>
----> 1 cmd_def.get('u3', [0], 0.3, 0.6, 0.9).draw()

~/Desktop/ajavadia-terra/qiskit/pulse/schedule.py in draw(self, dt, style, filename, interp_method, scaling, channels_to_plot, plot_all, plot_range, interactive, table, label, framechange, channels)
392                                           plot_range=plot_range, interactive=interactive,
393                                           table=table, label=label,
--> 394                                           framechange=framechange, channels=channels)
395
396     def __eq__(self, other: ScheduleComponent) -> bool:

~/Desktop/ajavadia-terra/qiskit/visualization/pulse_visualization.py in pulse_drawer(data, dt, style, filename, interp_method, scaling, channels_to_plot, plot_all, plot_range, interactive, table, label, framechange, channels)
75         image = drawer.draw(data, dt=dt, interp_method=interp_method, scaling=scaling,
76                             plot_range=plot_range, plot_all=plot_all, table=table,
---> 77                             label=label, framechange=framechange, channels=channels)
78     else:
79         raise VisualizationError('This data cannot be visualized.')

~/Desktop/ajavadia-terra/qiskit/visualization/pulse/matplotlib.py in draw(self, schedule, dt, interp_method, plot_range, scaling, channels_to_plot, plot_all, table, label, framechange, channels)
601         # prepare waveform channels
602         (schedule_channels, output_channels,
--> 603          snapshot_channels) = self._build_channels(schedule, channels_to_plot, t0, tf)
604
605         # count numbers of valid waveform

~/Desktop/ajavadia-terra/qiskit/visualization/pulse/matplotlib.py in _build_channels(self, schedule, channels_to_plot, t0, tf)
290         snapshot_channels = collections.OrderedDict()
291
--> 292         _channels = list(schedule.channels) + channels_to_plot
293         _channels = list(set(_channels))
294

TypeError: can only concatenate list (not "NoneType") to list

# Fixed code
def _build_channels(self, schedule, channels, t0, tf):
    # prepare waveform channels
    drive_channels = collections.OrderedDict()
    measure_channels = collections.OrderedDict()
    control_channels = collections.OrderedDict()
    acquire_channels = collections.OrderedDict()
    snapshot_channels = collections.OrderedDict()

    _channels = list(schedule.channels) + channels
    _channels = list(set(_channels))

    for chan in _channels:
        if isinstance(chan, DriveChannel):
            try:
                drive_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, MeasureChannel):
            try:
                measure_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, ControlChannel):
            try:
                control_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, AcquireChannel):
            try:
                acquire_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass
        elif isinstance(chan, SnapshotChannel):
            try:
                snapshot_channels[chan] = EventsOutputChannels(t0, tf)
            except PulseError:
                pass

    output_channels = {
        **drive_channels,
        **measure_channels,
        **control_channels,
        **acquire_channels,
    }
    channels = {**output_channels, **acquire_channels, **snapshot_channels}
    # sort by index then name to group qubits together.
    output_channels = collections.OrderedDict(
        sorted(output_channels.items(), key=lambda x: (x[0].index, x[0].name))
    )
    channels = collections.OrderedDict(
        sorted(channels.items(), key=lambda x: (x[0].index, x[0].name))
    )

    for start_time, instruction in schedule.instructions:
        for channel in instruction.channels:
            if channel in output_channels:
                output_channels[channel].add_instruction(start_time, instruction)
            elif channel in snapshot_channels:
                snapshot_channels[channel].add_instruction(start_time, instruction)
    return channels, output_channels, snapshot_channels