use isinstance(chan_data, basestring) here