class_docstr: Defines functionality for the available slot mappings.
class_docstr_tok: ["Defines","functionality","for","the","available","slot","mappings","."]
docstr: Convert object to a list if it isn't.
docstr_tok: ["Convert","object","to","a","list","if","it","is","n't","."]
code: def to_list(x: Optional[Any]) -> List[Any]:
      """Convert object to a list if it isn't."""
      if x is None:
          x = []
      elif not isinstance(x, list):
          x = [x]
  
      return x
  
file_path: rasa/rasa/shared/core/slot_mappings.py
imports: from typing import Text, Dict, Any, List, Optional, TYPE_CHECKING
  from rasa.shared.constants import DOCS_URL_SLOTS, IGNORED_INTENTS
  import rasa.shared.utils.io
  from rasa.shared.nlu.constants import ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_ROLE, ENTITY_ATTRIBUTE_GROUP, INTENT, NOT_INTENT, INTENT_NAME_KEY
  from rasa.shared.core.constants import SLOT_MAPPINGS, MAPPING_TYPE, SlotMappingType, MAPPING_CONDITIONS
label_desc: Use image node_id 4 for calling the SlotMapping obj's underlying member method code with example usage: obj.to_list(x) and returns: x