<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_font(font_file, font_name=None):
 """Add a font description to our directory of externally loadable fonts. `font_file` is the path to the font, and optional `font_name` is the name to register it under. """

    global font_dir

    if font_name is None:
        # determine family name from filename of font
        dirname, filename = os.path.split(font_file)
        font_name, ext = os.path.splitext(filename)

    font_dir[font_name] = Bunch.Bunch(name=font_name, font_path=font_file)

    return font_name