code: def _kl_masked_masked(p, q):
      if p._mask is False or q._mask is False:
          mask = False
      elif p._mask is True:
          mask = q._mask
      elif q._mask is True:
          mask = p._mask
      elif p._mask is q._mask:
          mask = p._mask
      else:
          mask = p._mask & q._mask
  
      if mask is False:
          return (
              0.0  # Return a float, since we cannot determine device.
          )
      if mask is True:
          return kl_divergence(p.base_dist, q.base_dist)
      kl = kl_divergence(p.base_dist, q.base_dist)
      return scale_and_mask(kl, mask=mask)
  
imports: import warnings
  from collections import OrderedDict
  from typing import Callable
  import torch
  from torch.distributions.kl import kl_divergence, register_kl
  import pyro.distributions.torch
  from .None import constraints
  from .distribution import Distribution
  from .score_parts import ScoreParts
  from .util import broadcast_shape, scale_and_mask
label_desc: Use image node_id 1 for calling a global function with example usage: _kl_masked_masked(p, q) and returns: scale_and_mask, int, kl_divergence