:mod:`ibid.compat` -- Python Version Compatibility
==================================================

.. module:: ibid.compat
   :synopsis: Python-version-independent imports of common modules
.. moduleauthor:: Ibid Core Developers

This module provides compatibility for older Python versions back to
2.4, allowing the use of some newer features.

The following modules and functions are available, and should be
imported from :mod:`ibid.compat` rather than elsewhere.

Modules
-------

.. describe:: email_utils

   Standard Python :mod:`email.utils`.

   Functions for parsing and formatting e-Mail headers.

.. describe:: hashlib

   Standard Python :mod:`hashlib`.

   Cryptographic hash functions.

   On Python 2.4 it won't support the SHA-2 functions:
   :func:`hashlib.sha224`, :func:`hashlib.sha384` and
   :func:`hashlib.sha51at`` and
   ``time_format``.

   Example::

      >>> format_date(datetime.utcnow())
      u'2009-12-14 12:41:55 SAST'

.. function:: parse_timestamp(timestamp)

   Parse string *timestamp*, convert it to UTC, and strip the timezone.

   This function is good at parsing machine timestamps, but can't handle
   "human" times very well. (It uses :mod:`dateutil.parser`)

   Return a naive :class:`datetime.datetime`.

.. function:: human_join(items, [separator=u',', conjunction=u'and'])

   Turn iterable *items* into a unicode list in the format ``a, b, c
   and d``.

   *separator* separates all values except the last two, separated by
   *conjunction*.

   Example::

      >>> human_join(['a', 'b', 'c', 'd'])
      u'a, b, c and d'

.. function:: plural(count, singular, plural)

   If *count* is 1, return *singular*, otherwise *plural*.

   It's recommended to use complete words for *singular* and *plural*
   rather than suffixes.

.. function:: decode_htmlentities(text)

   Return *text* with all HTML entities removed, both numeric and
   string-style.

.. function:: file_in_path(program)

   Returns a boolean indicating whether 