from typing import Dict


def _check_pyl_trainer_config(config: Dict) -> Dict:
    """
    Checks the trainer config for pytorch lightning and adds default values for missing required entries
    :param config: a dictionary with key:values required by the init_trainer function
    :return: dictionary with trainer config
    """
    default = {
        "gpus": 0,
        "epochs": 100,
        "period_eval": 1,
        "checkpoints_dir": "experiment_logs/",
        "checkpoints_name": "run",
        "monitor_metric_name": "loss",
        "monitor_metric_mode": "min",
        "use_early_stopping": False,
        "patience": 100,
        "save_top_k": 1,
    }
    config = {**default, **config}
    return config