from abc import ABC, abstractmethod


class BaseModel(ABC):
    @abstractmethod
    def to_dict(self) -> dict:
        raise NotImplementedError()

    @staticmethod
    def _is_empty(value) -> bool:
        return value is None or (hasattr(value, '__len__') and len(value or []) == 0)

    def get_model_data(self) -> dict:
        return {k: v for k, v in self.to_dict().items() if not self._is_empty(v)}
