docs: def load_configuration(app_name):
      '''
      creates a new configuration and loads the appropriate
      files.
      '''
      if sys.prefix == '/usr':
          conf_dir = '/etc'
          share_dir = '/usr/share'
      else:
          conf_dir = os.path.join(sys.prefix, 'etc')
          share_dir = os.path.join(sys.prefix, 'share')
      # Step 1: try to locate pynlp.yml
      yml_config = {}
      for fname in [
              '%s.yml'%(app_name,),
              os.path.expanduser('~/.%s.yml'%(app_name,)),
              os.path.join(conf_dir, '%s.yml'%(app_name,))]:
          if os.path.exists(fname):
              yml_config = yaml.load(open(fname))
              break
      try:
          data_dir = yml_config['paths']['data_dir']
      except KeyError:
          try:
              data_dir = os.environ[app_name.upper()]
          except KeyError:
              data_dir = os.path.join(share_dir, app_name)
      return AppContext(yml_config, data_dir)