def METHOD_NAME(cls, path: str):
    """checks if the path is valid
    """
    if isinstance(path, str):
        if not Path(path).is_file():
            raise ValueError(
                f"No file found at {path}")
        try:
            with open(path, 'r') as f:
                inventory = yaml.safe_load(f)
        except Exception as error:
            raise ValueError(
                f'Unable to process Ansible inventory: {str(error)}'
            )
    elif isinstance(path, Dict):
        inventory = path
    if '_meta' not in inventory \
            or 'hostvars' not in inventory['_meta']:
        if isinstance(inventory, list) and 'namespace' in inventory[0]:
            raise ValueError(
                'Invalid Ansible inventory, found Suzieq inventory'
            )
        raise ValueError(
            'Invalid Ansible inventory, missing keys: _meta and / or'
            "hostvars\n \tUse 'ansible-inventory --list' to create "
            'the correct file'
        )
    return inventory['_meta']['hostvars']