def METHOD_NAME(self):
    photo_upload = self.cleaned_data['photo_upload']
    if photo_upload:
        extension = splitext(photo_upload.name)[1]
        # check the extension
        if extension.lower() not in ALLOWED_LOGO_EXT:
            raise forms.ValidationError(_('The logo must be of jpg, gif, or png image type.'))
        # check the image header
        image_type = '.%s' % imghdr.what('', photo_upload.read())
        if image_type not in ALLOWED_LOGO_EXT:
            raise forms.ValidationError(_('The logo is an invalid image. Try uploading another logo.'))
        max_upload_size = get_max_file_upload_size()
        if photo_upload.size > max_upload_size:
            raise forms.ValidationError(_('Please keep filesize under %(max_upload_size)s. Current filesize %(upload_size)s') % {
                                'max_upload_size': filesizeformat(max_upload_size),
                                'upload_size': filesizeformat(photo_upload.size)})
    return photo_upload