@classmethod
def input_labelled(cls, label):
    """Returns an XPath to find an HTML <input> referred to by a <label> that contains the text in `label`."""
    for_based_xpath = (
        '//input[@id=//label[normalize-space(node())=normalize-space("%s")]/@for]'
         % label)
    nested_xpath = (
        '//label[normalize-space()=normalize-space("%s")]//input' % label)
    return cls('%s|%s' % (for_based_xpath, nested_xpath))
