def METHOD_NAME(
    cls, x: NNCFTensor, axis: Optional[Union[int, tuple, list]], mask: Optional[NNCFTensor], keepdims: bool = False
) -> NNCFTensor:
    if mask is None:
        return cls.median(x, axis=axis, keepdims=keepdims)
    masked_x = np.ma.array(x.tensor, mask=mask.tensor)
    return ONNXNNCFTensor(np.ma.median(masked_x, axis=axis, keepdims=keepdims).data)