'Tally databases.
Parameters
fout : output stream
Default is screen output.'

def tally(self, fout=None):

    if (fout is None):
        fout = sys.stdout
    str_list = []
    n_tot = 0
    for typ in self.dbtypes:
        n_cur = len(self.catkeys[typ])
        n_tot += n_cur
        str_list.append(u'{0}:    {1}    catalog(s)'.format(typ, n_cur))
    if (len(str_list) > 0):
        str_list.append(u'total:    {0}    catalog(s)\n'.format(n_tot))
        fout.write(u'\n'.join(str_list))
