code: def load_config(app_name, *args, **kwargs):
      configure_logging()
      prefix = kwargs.get('prefix', 'etc')
      verbose = kwargs.get('verbose', False)
      location = kwargs.get('location', None)
      passphrase = kwargs.get('passphrase',
          os.getenv("%s_SETTINGS_CRYPT_KEY" % app_name.upper(),
              os.getenv("SETTINGS_CRYPT_KEY", None)))
      confnames = args
      if not location:
          location = os.getenv("%s_SETTINGS_LOCATION" % app_name.upper(), None)
      if not location:
          location = os.getenv("SETTINGS_LOCATION", None)
          if location:
              location = "%s/%s" % (location, app_name)
      config = {}
      for confname in confnames:
          content = None
          if location and location.startswith('s3://'):
              try:
                  import boto
                  _, bucket_name, prefix = urlparse(location)[:3]
                  try:
                      conn = boto.connect_s3()
                      bucket = conn.get_bucket(bucket_name)
                      key_name = '%s/%s' % (prefix, confname)
                      key = bucket.get_key(key_name)
                      content = key.get_contents_as_string()
                      if verbose:
                          LOGGER.info("config loaded from 's3://%s/%s'",
                              bucket_name, key_name)
                  except (boto.exception.NoAuthHandlerFound,
                          boto.exception.S3ResponseError) as _:
                      pass
              except ImportError:
                  pass
          if not content:
              confpath = locate_config(
                  confname, app_name, location=location,
                  prefix=prefix, verbose=verbose)
              if confpath:
                  with open(confpath, 'rb') as conffile:
                      content = conffile.read()
          if content:
              if passphrase:
                  content = crypt.decrypt(content, passphrase)
              if hasattr(content, 'decode'):
                  content = content.decode('utf-8')
              for line in content.split('\n'):
                  if not line.startswith('
                      look = re.match(r'(\w+)\s*=\s*(.*)', line)
                      if look:
                          try:
                              config.update({look.group(1).upper():
                                  eval(look.group(2), {}, {})})
                          except Exception:
                              raise
      return config