code: def when(condition, value):
      
      sc = SparkContext._active_spark_context
      if not isinstance(condition, Column):
          raise TypeError("condition should be a Column")
      v = value._jc if isinstance(value, Column) else value
      jc = sc._jvm.functions.when(condition._jc, v)
      return Column(jc)
docs: Evaluates a list of conditions and returns one of multiple possible result expressions.
      If :func:`Column.otherwise` is not invoked, None is returned for unmatched conditions.
  
      :param condition: a boolean :class:`Column` expression.
      :param value: a literal value, or a :class:`Column` expression.
  
      >>> df.select(when(df['age'] == 2, 3).otherwise(4).alias("age")).collect()
      [Row(age=3), Row(age=4)]
  
      >>> df.select(when(df.age == 2, df.age + 1).alias("age")).collect()
      [Row(age=3), Row(age=None)]