'Set hierarchy of trackers (announce-list) following the spec
at http://www.bittorrent.org/beps/bep_0012.html
@param hier A hierarchy of trackers as a list of lists.'

def set_tracker_hierarchy(self, hier):

    newhier = []
    if (not isinstance(hier, ListType)):
        raise ValueError('hierarchy    is    not    a    list')
    for tier in hier:
        if (not isinstance(tier, ListType)):
            raise ValueError('tier    is    not    a    list')
        newtier = []
        for url in tier:
            if (not is_valid_url(url)):
                self._logger.error('Invalid    tracker    URL:    %s', repr(url))
                continue
            if url.endswith('/'):
                url = url[:(-1)]
            if (self.get_tracker() is None):
                self.set_tracker(url)
            newtier.append(url)
        newhier.append(newtier)
    self.input['announce-list'] = newhier
    self.metainfo_valid = False
