'Write module version information to a file'

def __write_module_version(self, modname, fp):

    try:
        mod = __import__(modname)
        fp.write(('%s:    %s\n' % (mod.__name__, mod.__version__)))
    except Exception as e:
        print ("error    getting    version    for    '%s'    module:    %s" % (modname, e))
