def editProfile(self, name, devices):
    def fetchEditPage(name, url):
      page = self._fetchPage(url)
      for profile in page.select('td.profile'):
        span = profile.find('span')
        if not span or name != span.text:
          continue

        links = profile.parent.select('td.action a[href*="/edit.action"]')
        if not links:
          continue
        link = '%s%s' % (self._baseUrl(url), links[0]['href'])
        return self._fetchPage(link)
      return None

    # Fetch the edit page for the specified provisioning profile.
    edit_page = fetchEditPage(name, _DISTRIBUTION_PROFILES_URL)
    if not edit_page:
      edit_page = fetchEditPage(name, _DEVELOPMENT_PROFILES_URL)
      if not edit_page:
        return

    # Find the save form.
    save_form = edit_page.find(id='save')
    if not save_form:
      return

    # Edit the form, selecting or deselecting desired devices.
    edits = []
    for device in devices:
      op = device[0]
      if op is '+' or op == '-':
        device = device[1:];
      else:
        op = '+'
      checkbox = save_form.find('input', value=device)
      if not checkbox:
        print >>sys.stderr, 'unable to find device: %s' % device
        continue
      device_name = checkbox.find_next_sibling('label').text
      if op == '+':
        if not checkbox.has_attr('checked'):
          checkbox['checked'] = 'checked'
          edits.append('  added %s' % device_name)
      elif checkbox.has_attr('checked'):
        del checkbox['checked']
        edits.append('  removed %s' % device_name)

    if not edits:
      print '%s: %s\n  no changes' % (self.username, name)
      return

    # Extract the form fields and submit
    fields = ExtractFormFields(save_form)
    url = '%s%s' % (self._baseUrl(edit_page.url), save_form['action'])
    self._fetchPage(url, urllib.urlencode(fields))
    print '%s: %s\n%s' % (self.username, name, '\n'.join(edits))
dataset/ETHPy150Open viewfinderco/viewfinder/clients/ios/scripts/app-tool.py/DevCenterClient.editProfile/operator `==` -> `is`