Adding a vars(self).update(metadata) here would avoid the need for the __getattr__. The attribute access would be faster, there would be no need to raise the AttributeError as below and you would not lose pickleability.