def _format_opts(opts):
 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(str(item))
  return new_opts
 elif (not isinstance(opts, six.string_types)):
  opts = [str(opts)]
 else:
  opts = salt.utils.shlex_split(opts)
 try:
  if (opts[(-1)] == '--'):
   return opts[:(-1)]
 except IndexError:
  pass
 return opts

def _format_opts ( opts ) : 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 ( str ( item ) ) return new_opts elif ( not isinstance ( opts , six . string_types ) ) : opts = [ str ( opts ) ] else : opts = salt . utils . shlex_split ( opts ) try : if ( opts [ ( - 1 ) ] == '--' ) : return opts [ : ( - 1 ) ] except IndexError : pass return opts
common code to inspect opts and split them if necessary .