Implement API for typemap cloning

The docs suggested cloning, but never provided an API.