code: def l1_l2_regularizer(weight_l1=1.0, weight_l2=1.0, scope=None):
    
    def regularizer(tensor):
      with tf.name_scope(scope, 'L1L2Regularizer', [tensor]):
        weight_l1_t = tf.convert_to_tensor(weight_l1,
                                           dtype=tensor.dtype.base_dtype,
                                           name='weight_l1')
        weight_l2_t = tf.convert_to_tensor(weight_l2,
                                           dtype=tensor.dtype.base_dtype,
                                           name='weight_l2')
        reg_l1 = tf.multiply(weight_l1_t, tf.reduce_sum(tf.abs(tensor)),
                        name='value_l1')
        reg_l2 = tf.multiply(weight_l2_t, tf.nn.l2_loss(tensor),
                        name='value_l2')
        return tf.add(reg_l1, reg_l2, name='value')
    return regularizer
docs: Define a L1L2 regularizer.
  
    Args:
      weight_l1: scale the L1 loss by this factor.
      weight_l2: scale the L2 loss by this factor.
      scope: Optional scope for name_scope.
  
    Returns:
      a regularizer function.