def _lightning_get_all_attr_holders(model, attribute):
    """
    Special attribute finding for Lightning. Gets all of the objects or dicts that holds attribute.
    Checks for attribute in model namespace, the old hparams namespace/dict, and the datamodule.
    """
    trainer = getattr(model, 'trainer', None)

    holders = []

    # Check if attribute in model
    if hasattr(model, attribute):
        holders.append(model)

    # Check if attribute in model.hparams, either namespace or dict
    if hasattr(model, 'hparams'):
        if attribute in model.hparams:
            holders.append(model.hparams)

    # Check if the attribute in datamodule (datamodule gets registered in Trainer)
    if trainer is not None and trainer.datamodule is not None and hasattr(trainer.datamodule, attribute):
        holders.append(trainer.datamodule)

    return holders