# pickle

### `pickle.dumps(obj) -> bytes`

Return the pickled representation of an object as a bytes object.

### `pickle.loads(b: bytes)`

Return the unpickled object from a bytes object.

## What can be pickled and unpickled?

The following types can be pickled:

- None, True, and False;
- integers, floating-point numbers;
- strings, bytes;
- tuples, lists, sets, and dictionaries containing only picklable objects;
- functions (user-defined) accessible from the top level of a module (using def, not lambda);
- classes accessible from the top level of a module;
- instances of such classes

The following magic methods are available:

- `__getnewargs__`
- `__getstate__`
- `__setstate__`
- `__reduce__`