def _get_registry(db_name):
    """Helper method to get the registry for a `db_name`."""
    from odoo.modules.registry import Registry
    if isinstance(db_name, str):
        db = Registry(db_name)
    elif isinstance(db_name, Registry):
        db = db_name
    else:
        import sys
        caller = sys.getframe(1).f_code.co_name
        raise TypeError('"%s" requires a string or a Registry' % caller)
    return db
