code: def loadYAML (filename=None, data=None):
      
      config = None
  
      try:
          if filename:
              data = open(filename, 'rt')
  
          config = yaml.load(data)
  
          if type(data) is file:
              data.close()
      except IOError, e:
          msg = 'Could not read AIT configuration file "%s": %s'
          log.error(msg, filename, str(e))
  
      return config
docs: Loads either the given YAML configuration file or YAML data.
  
      Returns None if there was an error reading from the configuration
      file and logs an error message via ait.core.log.error().