code: def element_id_by_label(browser, label):
      
      label = XPathSelector(browser,
                            unicode('//label[contains(., "%s")]' % label))
      if not label:
          return False
      return label.get_attribute('for')
docs: Return the id of a label's for attribute