nodes: 0, module; 1, function_definition; 2, function_name:dump; 3, parameters; 4, block; 5, identifier:obj; 6, identifier:fp; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, identifier:container_count; 16, False; 17, identifier:sort_keys; 18, False; 19, identifier:no_float32; 20, True; 21, identifier:default; 22, None; 23, comment:"""Writes the given object as UBJSON to the provided file-like object
  
      Args:
          obj: The object to encode
          fp: write([size])-able object
          container_count (bool): Specify length for container types (including
                                  for empty ones). This can aid decoding speed
                                  depending on implementation but requires a bit
                                  more space and encoding speed could be reduced
                                  if getting length of any of the containers is
                                  expensive.
          sort_keys (bool): Sort keys of mappings
          no_float32 (bool): Never use float32 to store float numbers (other than
                             for zero). Disabling this might save space at the
                             loss of precision.
          default (callable): Called for objects which cannot be serialised.
                              Should return a UBJSON-encodable version of the
                              object or raise an EncoderException.
  
      Raises:
          EncoderException: If an encoding failure occured.
  
      The following Python types and interfaces (ABCs) are supported (as are any
      subclasses):
  
      +------------------------------+-----------------------------------+
      | Python                       | UBJSON                            |
      +==============================+===================================+
      | (3) str                      | string                            |
      | (2) unicode                  |                                   |
      +------------------------------+-----------------------------------+
      | None                         | null                              |
      +------------------------------+-----------------------------------+
      | bool                         | true, false                       |
      +------------------------------+-----------------------------------+
      | (3) int                      | uint8, int8, int16, int32, int64, |
      | (2) int, long                | high_precision                    |
      +------------------------------+-----------------------------------+
      | float                        | float32, float64, high_precision  |
      +------------------------------+-----------------------------------+
      | Decimal                      | high_precision                    |
      +------------------------------+-----------------------------------+
      | (3) bytes, bytearray         | array (type, uint8)               |
      | (2) str                      | array (type, uint8)               |
      +------------------------------+-----------------------------------+
      | (3) collections.abc.Mapping  | object                            |
      | (2) collections.Mapping      |                                   |
      +------------------------------+-----------------------------------+
      | (3) collections.abc.Sequence | array                             |
      | (2) collections.Sequence     |                                   |
      +------------------------------+-----------------------------------+
  
      Notes:
      - Items are resolved in the order of this table, e.g. if the item implements
        both Mapping and Sequence interfaces, it will be encoded as a mapping.
      - None and bool do not use an isinstance check
      - Numbers in brackets denote Python version.
      - Only unicode strings in Python 2 are encoded as strings, i.e. for
        compatibility with e.g. Python 3 one MUST NOT use str in Python 2 (as that
        will be interpreted as a byte array).
      - Mapping keys have to be strings: str for Python3 and unicode or str in
        Python 2.
      - float conversion rules (depending on no_float32 setting):
          float32: 1.18e-38 <= abs(value) <= 3.4e38 or value == 0
          float64: 2.23e-308 <= abs(value) < 1.8e308
          For other values Decimal is used.
      """; 24, not_operator; 25, block; 26, assignment; 27, call; 28, call; 29, raise_statement; 30, identifier:fp_write; 31, attribute; 32, identifier:__encode_value; 33, argument_list; 34, identifier:callable; 35, argument_list; 36, call; 37, identifier:fp; 38, identifier:write; 39, identifier:fp_write; 40, identifier:obj; 41, dictionary; 42, identifier:container_count; 43, identifier:sort_keys; 44, identifier:no_float32; 45, identifier:default; 46, attribute; 47, identifier:TypeError; 48, argument_list; 49, identifier:fp; 50, identifier:write; 51, string; 52, string_content:fp.write not callable
code: def dump(obj, fp, container_count=False, sort_keys=False, no_float32=True, default=None):
      """Writes the given object as UBJSON to the provided file-like object
  
      Args:
          obj: The object to encode
          fp: write([size])-able object
          container_count (bool): Specify length for container types (including
                                  for empty ones). This can aid decoding speed
                                  depending on implementation but requires a bit
                                  more space and encoding speed could be reduced
                                  if getting length of any of the containers is
                                  expensive.
          sort_keys (bool): Sort keys of mappings
          no_float32 (bool): Never use float32 to store float numbers (other than
                             for zero). Disabling this might save space at the
                             loss of precision.
          default (callable): Called for objects which cannot be serialised.
                              Should return a UBJSON-encodable version of the
                              object or raise an EncoderException.
  
      Raises:
          EncoderException: If an encoding failure occured.
  
      The following Python types and interfaces (ABCs) are supported (as are any
      subclasses):
  
      +------------------------------+-----------------------------------+
      | Python                       | UBJSON                            |
      +==============================+===================================+
      | (3) str                      | string                            |
      | (2) unicode                  |                                   |
      +------------------------------+-----------------------------------+
      | None                         | null                              |
      +------------------------------+-----------------------------------+
      | bool                         | true, false                       |
      +------------------------------+-----------------------------------+
      | (3) int                      | uint8, int8, int16, int32, int64, |
      | (2) int, long                | high_precision                    |
      +------------------------------+-----------------------------------+
      | float                        | float32, float64, high_precision  |
      +------------------------------+-----------------------------------+
      | Decimal                      | high_precision                    |
      +------------------------------+-----------------------------------+
      | (3) bytes, bytearray         | array (type, uint8)               |
      | (2) str                      | array (type, uint8)               |
      +------------------------------+-----------------------------------+
      | (3) collections.abc.Mapping  | object                            |
      | (2) collections.Mapping      |                                   |
      +------------------------------+-----------------------------------+
      | (3) collections.abc.Sequence | array                             |
      | (2) collections.Sequence     |                                   |
      +------------------------------+-----------------------------------+
  
      Notes:
      - Items are resolved in the order of this table, e.g. if the item implements
        both Mapping and Sequence interfaces, it will be encoded as a mapping.
      - None and bool do not use an isinstance check
      - Numbers in brackets denote Python version.
      - Only unicode strings in Python 2 are encoded as strings, i.e. for
        compatibility with e.g. Python 3 one MUST NOT use str in Python 2 (as that
        will be interpreted as a byte array).
      - Mapping keys have to be strings: str for Python3 and unicode or str in
        Python 2.
      - float conversion rules (depending on no_float32 setting):
          float32: 1.18e-38 <= abs(value) <= 3.4e38 or value == 0
          float64: 2.23e-308 <= abs(value) < 1.8e308
          For other values Decimal is used.
      """
      if not callable(fp.write):
          raise TypeError('fp.write not callable')
      fp_write = fp.write
  
      __encode_value(fp_write, obj, {}, container_count, sort_keys, no_float32, default)