Python API: added pickle support for Pattern