code: def read_yaml_config(filename, check=True, osreplace=True, exit=True):
      
      location = filename
      if location is not None:
          location = path_expand(location)
  
      if not os.path.exists(location) and not check:
          return None
  
      if check and os.path.exists(location):
  
          # test for tab in yaml file
          if check_file_for_tabs(location):
              log.error("The file {0} contains tabs. yaml "
                        "Files are not allowed to contain tabs".format(location))
              sys.exit()
          result = None
          try:
  
              if osreplace:
                  result = open(location, 'r').read()
                  t = Template(result)
                  result = t.substitute(os.environ)
  
                  # data = yaml.safe_load(result)
                  data = ordered_load(result, yaml.SafeLoader)
              else:
                  f = open(location, "r")
  
                  # data = yaml.safe_load(f)
  
                  data = ordered_load(result, yaml.SafeLoader)
                  f.close()
  
              return data
          except Exception as e:
              log.error(
                  "The file {0} fails with a yaml read error".format(filename))
              Error.traceback(e)
              sys.exit()
  
      else:
          log.error("The file {0} does not exist.".format(filename))
          if exit:
              sys.exit()
  
      return None
docs: reads in a yaml file from the specified filename. If check is set to true
      the code will fail if the file does not exist. However if it is set to
      false and the file does not exist, None is returned.
  
      :param exit: if true is exist with sys exit
      :param osreplace: if true replaces environment variables from the OS
      :param filename: the file name
      :param check: if True fails if the file does not exist,
                    if False and the file does not exist return will be None