code: def _get_stage_variables(stage_variables):
      '''
      Helper function to retrieve stage variables from pillars/options, if the
      input is a string
      '''
      ret = dict()
      if stage_variables is None:
          return ret
  
      if isinstance(stage_variables, six.string_types):
          if stage_variables in __opts__:
              ret = __opts__[stage_variables]
          master_opts = __pillar__.get('master', {})
          if stage_variables in master_opts:
              ret = master_opts[stage_variables]
          if stage_variables in __pillar__:
              ret = __pillar__[stage_variables]
      elif isinstance(stage_variables, dict):
          ret = stage_variables
  
      if not isinstance(ret, dict):
          ret = dict()
  
      return ref _get_stage_variables(stage_variables):
      '''
      Helper function to retrieve stage variables from pillars/options, if the
      input is a string
      '''
      ret = dict()
      if stage_variables is None:
          return ret
  
      if isinstance(stage_variables, six.string_types):
          if stage_variables in __opts__:
              ret = __opts__[stage_variables]
          master_opts = __pillar__.get('master', {})
          if stage_variables in master_opts:
              ret = master_opts[stage_variables]
          if stage_variables in __pillar__:
              ret = __pillar__[stage_variables]
      elif isinstance(stage_variables, dict):
          ret = stage_variables
  
      if not isinstance(ret, dict):
          ret = dict()
  
      return ret
docs: Helper function to retrieve stage variables from pillars/options, if the
      input is a string