'This is the function that checks comments.
It returns ``True`` for spam and ``False`` for ham.
If you set ``DEBUG=True`` then it will return the text of the response,
instead of the ``True`` or ``False`` object.
It raises ``APIKeyError`` if you have not yet set an API key.
If the connection to Akismet fails then the ``HTTPError`` or
``URLError`` will be propogated.
As a minimum it requires the body of the comment. This is the
``comment`` argument.
Akismet requires some other arguments, and allows some optional ones.
The more information you give it, the more likely it is to be able to
make an accurate diagnosise.
You supply these values using a mapping object (dictionary) as the
``data`` argument.
If ``build_data`` is ``True`` (the default), then *akismet.py* will
attempt to fill in as much information as possible, using default
values where necessary. This is particularly useful for programs
running in a {acro;CGI} environment. A lot of useful information
can be supplied from evironment variables (``os.environ``). See below.
You *only* need supply values for which you don\'t want defaults filled
in for. All values must be strings.
There are a few required values. If they are not supplied, and
defaults can\'t be worked out, then an ``AkismetError`` is raised.
If you set ``build_data=False`` and a required value is missing an
``AkismetError`` will also be raised.
The normal values (and defaults) are as follows : ::
\'user_ip\':          os.environ[\'REMOTE_ADDR\']       (*)
\'user_agent\':       os.environ[\'HTTP_USER_AGENT\']   (*)
\'referrer\':         os.environ.get(\'HTTP_REFERER\', \'unknown\') [#]_
\'permalink\':        \'\'
\'comment_type\':     \'comment\' [#]_
\'comment_author\':   \'\'
\'comment_author_email\': \'\'
\'comment_author_url\': \'\'
\'SERVER_ADDR\':      os.environ.get(\'SERVER_ADDR\', \'\')
\'SERVER_ADMIN\':     os.environ.get(\'SERVER_ADMIN\', \'\')
\'SERVER_NAME\':      os.environ.get(\'SERVER_NAME\', \'\')
\'SERVER_PORT\':      os.environ.get(\'SERVER_PORT\', \'\')
\'SERVER_SIGNATURE\': os.environ.get(\'SERVER_SIGNATURE\', \'\')
\'SERVER_SOFTWARE\':  os.environ.get(\'SERVER_SOFTWARE\', \'\')
\'HTTP_ACCEPT\':      os.environ.get(\'HTTP_ACCEPT\', \'\')
(*) Required values
You may supply as many additional \'HTTP_*\' type values as you wish.
These should correspond to the http headers sent with the request.
.. [#] Note the spelling "referrer". This is a required value by the
akismet api - however, referrer information is not always
supplied by the browser or server. In fact the HTTP protocol
forbids relying on referrer information for functionality in
programs.
.. [#] The `API docs <http://akismet.com/development/api/>`_ state that this value
can be " *blank, comment, trackback, pingback, or a made up value*
*like \'registration\'* ".'

def comment_check(self, comment, data=None, build_data=True, DEBUG=False):

    if (self.key is None):
        raise APIKeyError('Your    have    not    set    an    API    key.')
    if (data is None):
        data = {}
    if build_data:
        self._build_data(comment, data)
    if ('blog' not in data):
        data['blog'] = self.blog_url
    url = ('%scomment-check' % self._getURL())
    headers = {'User-Agent': self.user_agent}
    resp = self._safeRequest(url, urlencode(data), headers)
    if DEBUG:
        return resp
    resp = resp.lower()
    if (resp == 'true'):
        return True
    elif (resp == 'false'):
        return False
    else:
        raise AkismetError('missing    required    argument.')
