code: def validate_proxy(path):
      
      # load the proxy from path
      try:
          proxy = M2Crypto.X509.load_cert(path)
      except Exception, e:
          msg = "Unable to load proxy from path %s : %s" % (path, e)
          raise RuntimeError(msg)
  
      # make sure the proxy is RFC 3820 compliant
      try:
          proxy.get_ext("proxyCertInfo")
      except LookupError:
          subject = proxy.get_subject().as_text()
          if re.search(r'.+CN=proxy$', subject):
              raise RuntimeError("Could not find a RFC 3820 compliant proxy "
                                 "credential. Please run 'grid-proxy-init -rfc' "
                                 "and try again.")
  
      # attempt to make sure the proxy is still good for more than 15 minutes
      try:
          expireASN1 = proxy.get_not_after().__str__()
          expireGMT  = time.strptime(expireASN1, "%b %d %H:%M:%S %Y %Z")
          expireUTC  = calendar.timegm(expireGMT)
          now = int(time.time())
          secondsLeft = expireUTC - now
      except Exception, e:
          # problem getting or parsing time so just let the client
          # continue and pass the issue along to the server
          secondsLeft = 3600
  
      if secondsLeft <= 0:
          raise RuntimeError("Your proxy certificate is expired.\n"
                             "Please generate a new proxy certificate and "
                             "try again. ")
      if secondsLeft < (60 * 15):
          raise RuntimeError("Your proxy certificate expires in less than 15 "
                             "minutes.\nPlease generate a new proxy "
                             "certificate and try again.")
  
      # return True to indicate validated proxy
      return True
docs: Validate the users X509 proxy certificate
  
      Tests that the proxy certificate is RFC 3820 compliant and that it
      is valid for at least the next 15 minutes.
  
      @returns: L{True} if the certificate validates
      @raises RuntimeError: if the certificate cannot be validated