code: def get_token_ids(tree):
          def tok2time(token_element):
              '''
              extracts the time (float) of a <tli> element
              (i.e. the absolute position of a token in the document)
              '''
              return float(token_element.attrib['time'])
          timeline = tree.find('//common-timeline')
          return (tok.attrib['id']
                  for tok in sorted((tli for tli in timeline.iterchildren()),
                                    key=tok2time))