code: def quoted(text):
      
      if text and " " in text:
          sep = "'" if '"' in text else '"'
          return "%s%s%s" % (sep, text, sep)
      return text
docs: Args:
          text (str | unicode | None): Text to optionally quote
  
      Returns:
          (str): Quoted if 'text' contains spaces