code: def handle_partial_sample_weights(y, sample_weights):
      any_sample_weight = sample_weights is not None and any(
          w is not None for w in sample_weights
      )
      partial_sample_weight = any_sample_weight and any(
          w is None for w in sample_weights
      )
  
      if not any_sample_weight:
          return None
  
      if not partial_sample_weight:
          return sample_weights
  
imports: import collections
  import functools
  import math
  import typing
  import jax
  import jax.numpy
  import numpy
  import six
  import typing_extensions
  from elegy import types, utils
label_desc: Use image node_id 7 for calling a global function with example usage: handle_partial_sample_weights(y, sample_weights) and returns: None, sample_weights