def write_author_ids(cmd, basename, filename):
    """Write the author IDs to an egg-info file.

    Copy the author IDs from a local file into an egg-info file, when the distribution
    attribute ``include_author_ids`` is ``True``. The attribute value is typically
    set by argument ``include_author_ids`` in ``setuptools.setup()``. Intended for use
    by setuptools only.

    Args:
       cmd (setuptools.command.egg_info.egg_info): Object creating a distribution's
           egg-info directory and contents.
       basename (str): Filename to write.
       filename (str): Complete path, with filename, to write.
    """
    import os
    if cmd.distribution.include_author_ids:
        argname = os.path.splitext(basename)[0]
        author_ids = open(basename).read()
        cmd.write_or_delete_file(argname, filename, author_ids)
