code: def find_field_by_label(browser, field, label):
      
  
      return XPathSelector(browser,
                           field_xpath(field, 'id', escape=False) %
                           u'//label[contains(., "{0}")]/@for'.format(label))
docs: Locate the control input that has a label pointing to it
  
      This will first locate the label element that has a label of the given
      name. It then pulls the id out of the 'for' attribute, and uses it to
      locate the element by its id.