code: def _format_opts(opts):
      '''
      Common code to inspect opts and split them if necessary
      '''
      if opts is None:
          return []
      elif isinstance(opts, list):
          new_opts = []
          for item in opts:
              if isinstance(item, six.string_types):
                  new_opts.append(item)
              else:
                  new_opts.append(six.text_type(item))
          return new_opts
      else:
          if not isinstance(opts, six.string_types):
              opts = [six.text_type(opts)]
          else:
              opts = salt.utils.args.shlex_split(opts)
      opts = salt.utils.data.decode(opts)
      try:
          if opts[-1] == '--':
              # Strip the '--' if it was passed at the end of the opts string,
              # it'll be added back (if necessary) in the calling function.
              # Putting this check here keeps it from having to be repeated every
              # time _format_opts() is invoked.
              return opts[:-1]
      except IndexError:
          pass
      return optf _format_opts(opts):
      '''
      Common code to inspect opts and split them if necessary
      '''
      if opts is None:
          return []
      elif isinstance(opts, list):
          new_opts = []
          for item in opts:
              if isinstance(item, six.string_types):
                  new_opts.append(item)
              else:
                  new_opts.append(six.text_type(item))
          return new_opts
      else:
          if not isinstance(opts, six.string_types):
              opts = [six.text_type(opts)]
          else:
              opts = salt.utils.args.shlex_split(opts)
      opts = salt.utils.data.decode(opts)
      try:
          if opts[-1] == '--':
              # Strip the '--' if it was passed at the end of the opts string,
              # it'll be added back (if necessary) in the calling function.
              # Putting this check here keeps it from having to be repeated every
              # time _format_opts() is invoked.
              return opts[:-1]
      except IndexError:
          pass
      return opts
docs: Common code to inspect opts and split them if necessary