'Retrieve cmdset for channels this source_object has
access to send to.
Args:
source_object (Object): An object subscribing to one
or more channels.
Returns:
cmdsets (list): The Channel-Cmdsets `source_object` has
access to.'

def get_cmdset(self, source_object):

    if (source_object in self.cached_cmdsets):
        return self.cached_cmdsets[source_object]
    else:
        chan_cmdset = None
        chan_cmds = [channelcmd for (channel, channelcmd) in self.cached_channel_cmds.iteritems() if (channel.subscriptions.has(source_object) and channelcmd.access(source_object, 'send'))]
        if chan_cmds:
            chan_cmdset = cmdset.CmdSet()
            chan_cmdset.key = 'ChannelCmdSet'
            chan_cmdset.priority = 101
            chan_cmdset.duplicates = True
            for cmd in chan_cmds:
                chan_cmdset.add(cmd)
        self.cached_cmdsets[source_object] = chan_cmdset
        return chan_cmdset
