human
Complete this python program:
def _name_to_kw(category_cls, name):
assistant
#Here is the Python code you requested.

    """Get the keywords needed to build an instance of traffic data.
    """
    def target_split(name):
        'Split    a    name    that    contains    multiple    words.\n\n                                Name    is    (link,campaign-subreddit)    where    link    and    campaign    are\n                                thing    fullnames.    campaign    and    subreddit    are    each    optional,    so\n                                the    string    could    look    like    any    of    these:\n                                (t3_bh,t8_ab-pics),    (t3_bh,t8_ab),    (t3_bh,-pics),    (t3_bh,)\n                                Also    check    for    the    old    format    (t3_by,    pics)\n\n                                '
        (link_codename, target_info) = name
        campaign_codename = None
        if (not target_info):
            subreddit = ''
        elif (target_info.find('-') != (-1)):
            (campaign_codename, subreddit) = target_info.split('-', 1)
        elif (target_info.find('_') != (-1)):
            campaign_codename = target_info
            subreddit = ''
        else:
            subreddit = target_info
        return {'codename': (campaign_codename or link_codename), 'subreddit': subreddit}
    d = {SitewidePageviews: (lambda n: {}), PageviewsBySubreddit: (lambda n: {'subreddit': n}), PageviewsBySubredditAndPath: (lambda n: {'srpath': n}), PageviewsByLanguage: (lambda n: {'lang': n}), ClickthroughsByCodename: (lambda n: {'codename': name}), AdImpressionsByCodename: (lambda n: {'codename': name}), TargetedClickthroughsByCodename: target_split, TargetedImpressionsByCodename: target_split}
    return d[category_cls](name)