<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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)