code: def get_weights_fn(modality_type, value=None):
    
    if modality_type in (ModalityType.CTC_SYMBOL,
                         ModalityType.IDENTITY_SYMBOL,
                         ModalityType.MULTI_LABEL,
                         ModalityType.SYMBOL,
                         ModalityType.SYMBOL_ONE_HOT):
      return common_layers.weights_nonzero
    elif modality_type in ModalityType.get_choices():
      return common_layers.weights_all
    return value
docs: Gets default weights function; if none available, return value.