def hydrate(self, bundle):
        """Hydrate handles the conversion of fqdn to a label or domain."""
        if 'fqdn' in bundle.data:
            try:
                label_domain = ensure_label_domain(bundle.data['fqdn'])
                bundle.data['label'], bundle.data['domain'] = label_domain
            except __HOLE__, e:
                errors = {}
                errors['fqdn'] = e.messages
                bundle.errors['error_messages'] = json.dumps(errors)
                # We should use an Error(Dict|List) to maintain consistency
                # with the errors that are thrown by full_clean.
        else:
            errors = {}
            errors['fqdn'] = ("Couldn't determine a label and "
                              "domain for this record.")
            bundle.errors['error_messages'] = json.dumps(errors)

        if 'ttl' in bundle.data and bundle.data['ttl'] == 'None':
            bundle.data['ttl'] = None

        return bundle
dataset/ETHPy150Open mozilla/inventory/mozdns/api/v1/api.py/CommonDNSResource.hydrate