``self.name = getattr(metadata, 'name', None)`` is sufficient.