Locate the control input that has a label pointing to it.

    :param browser: ``world.browser``
    :param string field_type: a field type (i.e. `button`)
    :param string label: label text

    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.

    Returns: an :class:`ElementSelector`

def find_field_by_label(browser, field_type, label):
    """
    Locate the control input that has a label pointing to it.

    :param browser: ``world.browser``
    :param string field_type: a field type (i.e. `button`)
    :param string label: label text

    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.

    Returns: an :class:`ElementSelector`
    """

    return ElementSelector(
        browser,
        xpath=field_xpath(field_type, 'id') %
        '//label[contains(., {0})]/@for'.format(
            string_literal(label)),
        filter_displayed=True,
    )