def validate_response(self, value, model_instance):
        """
        Validation method to ensure that the provider's response is valid for
        the given resource.

        The oEmbed 1.0 spec permits three classes of errors:
        - 404 if the provider has no resource for the requested url
        - 401 if the specified URL contains a private (non-public) resource
        - 501 if the provider cannot return a response in the requested format

        Though all HTTP errors are raised, friendly error messages are only
        provided for each of these permitted scenarios.
        """

        object_name = model_instance._meta.verbose_name
        try:
            model_instance.oembed_retrieve(suppress_http_errors=False)
        except __HOLE__, e:
            if e.code == 404:
                message = _('%s not found' % object_name)
            elif e.code == 401:
                message = _((
                    'This %s is marked as private; you should link to it '
                    'directly to allow the provider to regulate access control'
                ) % object_name)
            elif e.code == 501:
                message = _(
                    '%s not available in the requested format' % object_name
                )
            else:
                message = _(e.msg)
            raise ValidationError(message)
        except URLError:
            raise ValidationError(_('Unable to contact server'))
dataset/ETHPy150Open chuckharmston/django-tumblelog/tumblelog/fields.py/OEmbedURLField.validate_response