code: def _select_helper(args, kwargs):
      
      if len(args) > 1:
          raise TypeError("select accepts at most ONE positional argument.")
  
      if len(args) > 0 and len(kwargs) > 0:
          raise TypeError("select accepts EITHER a positional argument, OR keyword arguments (not both).")
  
      if len(args) == 0 and len(kwargs) == 0:
          raise TypeError("select requires EITHER a positional argument, OR keyword arguments.")
  
      if args:
          arg = args[0]
          if isinstance(arg, dict):
              selector = arg
          elif isinstance(arg, string_types):
              selector = dict(name=arg)
          elif isinstance(arg, type) and issubclass(arg, Model):
              selector = {"type": arg}
          else:
              raise TypeError("selector must be a dictionary, string or plot object.")
  
      elif 'selector' in kwargs:
          if len(kwargs) == 1:
              selector = kwargs['selector']
          else:
              raise TypeError("when passing 'selector' keyword arg, not other keyword args may be present")
  
      else:
          selector = kwargs
  
      return selector
docs: Allow flexible selector syntax.
  
      Returns:
          dict