Loads the font specified by name and returns it as an instance of
    `PIL.ImageFont <http://pillow.readthedocs.io/en/latest/reference/ImageFont.html>`_
    class.

def load(name):
    """
    Loads the font specified by name and returns it as an instance of
    `PIL.ImageFont <http://pillow.readthedocs.io/en/latest/reference/ImageFont.html>`_
    class.
    """
    try:
        font_dir = os.path.dirname(__file__)
        pil_file = os.path.join(font_dir, '{}.pil'.format(name))
        pbm_file = os.path.join(font_dir, '{}.pbm'.format(name))
        return ImageFont.load(pil_file)
    except FileNotFoundError:
        raise Exception('Failed to load font "{}". '.format(name) +
        'Check ev3dev.fonts.available() for the list of available fonts')