def from_node(value: Union[str, Dict[str, Any], None]) -> 'Status':
        """Factory method to parse *value* as :class:`Status` object.

        :param value: JSON serialized string or :class:`dict` object.

        :returns: constructed :class:`Status` object.
        """
        try:
            if isinstance(value, str):
                value = json.loads(value)
        except Exception:
            return Status.empty()

        if isinstance(value, int):  # legacy
            return Status(value, None, [])

        if not isinstance(value, dict):
            return Status.empty()

        try:
            last_lsn = int(value.get('optime', ''))
        except Exception:
            last_lsn = 0

        slots: Union[str, Dict[str, int], None] = value.get('slots')
        if isinstance(slots, str):
            try:
                slots = json.loads(slots)
            except Exception:
                slots = None
        if not isinstance(slots, dict):
            slots = None

        retain_slots: Union[str, List[str], None] = value.get('retain_slots')
        if isinstance(retain_slots, str):
            try:
                retain_slots = json.loads(retain_slots)
            except Exception:
                retain_slots = []
        if not isinstance(retain_slots, list):
            retain_slots = []

        return Status(last_lsn, slots, retain_slots)
Factory method to parse *value* as :class:`Status` object.

        :param value: JSON serialized string or :class:`dict` object.

        :returns: constructed :class:`Status` object.
        
patroni/dcs/__init__.py