def METHOD_NAME(opener, target_url, cookie, debug=False):
  opener.addheaders = [('User-agent', 'curl-sso-certificate/0.0.2')] #in sync with cern-get-sso-cookie tool
  url = getResponseURL(opener, getParentURL(target_url), debug=debug)
  content = getResponseContent(opener, url, debug=debug)
  ret = re.search('<form .+? action="(.+?)">', content)
  if ret == None:
    raise Exception("error: The page doesn't have the form with adfs url, check 'User-agent' header")
  url = urllib2.unquote(ret.group(1))
  h = HTMLParser.HTMLParser()
  post_data_local = ''
  for match in re.finditer('input type="hidden" name="([^"]*)" value="([^"]*)"', content):
    post_data_local += "&%s=%s" % (match.group(1), urllib.quote(h.unescape(match.group(2))))
    is_link_found = True
  if not is_link_found:
    raise Exception("error: The page doesn't have the form with security attributes, check 'User-agent' header")
  post_data_local = post_data_local[1:] #remove first &
  getResponseContent(opener, url, post_data_local, debug)