def METHOD_NAME(instance, catalog):
    """Returns the metadata for the given instance from the specified catalog
    """
    path = api.get_path(instance)
    try:
        return catalog.getMetadataForUID(path)
    except KeyError:
        logger.info("Generating catalog metadata for '{}' manually"
                    .format(path))
        metadata = {}
        for key in catalog.schema():
            attr = getattr(instance, key, None)
            if callable(attr):
                attr = attr()
            metadata[key] = attr
        return metadata