'Add a catalog to database.
Parameters
name : str
Primary key for the catalog.
cat : `VOSCatalog`
Catalog to add.
allow_duplicate_url : bool
Allow catalog with duplicate access URL?
Raises
VOSError
Invalid catalog.
DuplicateCatalogName
Catalog with given name already exists.
DuplicateCatalogURL
Catalog with given access URL already exists.'

def add_catalog(self, name, cat, allow_duplicate_url=False):

    if (not isinstance(cat, VOSCatalog)):
        raise VOSError(u'{0}    is    not    a    VO    Service    Catalog.'.format(cat))
    if (name in self._catalogs):
        raise DuplicateCatalogName(u'{0}    already    exists.'.format(name))
    url = cat[u'url']
    names = self._url_keys[url]
    if ((len(names) > 0) and (not allow_duplicate_url)):
        raise DuplicateCatalogURL(u'{0}    already    exists:    {1}'.format(url, names))
    self._catalogs[name] = deepcopy(cat._tree)
    self._url_keys[url].append(name)
