'Get a mapping of (\'HB\', \'2\') tuples to version urls.'

def _versions_dict(self, session):

    res = defaultdict(dict)
    url = ('http://leg.mt.gov/bills/%s/BillPdf/' % session)
    html = self.get(url).text
    doc = lxml.html.fromstring(html)
    for url in doc.xpath('//a[contains(@href,    "/bills/")]/@href')[1:]:
        doc = self.lxmlize(url)
        for fn in doc.xpath('//a/@href')[1:]:
            _url = urljoin(url, fn)
            fn = fn.split('/')[(-1)]
            m = re.search('([A-Z]+)0*(\\d+)_?(.*?)\\.pdf', fn)
            if m:
                (type_, id_, version) = m.groups()
                res[(type_, id_)][version] = _url
    return res
