code: def _state_data_to_yaml_string(data, whitelist=None, blacklist=None):
      '''
      return a data dict in yaml string format.
      '''
      y = {}
      if blacklist is None:
          # TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS  STATE_RUNTIME_KEYWORDS  STATE_INTERNAL_KEYWORDS
          blacklist = ['__env__', '__id__', '__sls__', 'fun', 'name', 'context', 'order', 'state', 'require', 'require_in', 'watch', 'watch_in']
      kset = set(data.keys())
      if blacklist:
          kset -= set(blacklist)
      if whitelist:
          kset &= set(whitelist)
      for k in kset:
          y[k] = data[k]
      if not y:
          return None
      return salt.utils.yaml.safe_dump(y, default_flow_style=Falsef _state_data_to_yaml_string(data, whitelist=None, blacklist=None):
      '''
      return a data dict in yaml string format.
      '''
      y = {}
      if blacklist is None:
          # TODO: use salt defined STATE_REQUISITE_IN_KEYWORDS  STATE_RUNTIME_KEYWORDS  STATE_INTERNAL_KEYWORDS
          blacklist = ['__env__', '__id__', '__sls__', 'fun', 'name', 'context', 'order', 'state', 'require', 'require_in', 'watch', 'watch_in']
      kset = set(data.keys())
      if blacklist:
          kset -= set(blacklist)
      if whitelist:
          kset &= set(whitelist)
      for k in kset:
          y[k] = data[k]
      if not y:
          return None
      return salt.utils.yaml.safe_dump(y, default_flow_style=False)
docs: return a data dict in yaml string format.