code: def _ifelse(expr, true_expr, false_expr):
      
  
      tps = (SequenceExpr, Scalar)
      if not isinstance(true_expr, tps):
          true_expr = Scalar(_value=true_expr)
      if not isinstance(false_expr, tps):
          false_expr = Scalar(_value=false_expr)
  
      output_type = utils.highest_precedence_data_type(
              *[true_expr.dtype, false_expr.dtype])
      is_sequence = isinstance(expr, SequenceExpr) or \
                    isinstance(true_expr, SequenceExpr) or \
                    isinstance(false_expr, SequenceExpr)
  
      if is_sequence:
          return IfElse(_input=expr, _then=true_expr, _else=false_expr,
                        _data_type=output_type)
      else:
          return IfElse(_input=expr, _then=true_expr, _else=false_expr,
                        _value_type=output_type)
docs: Given a boolean sequence or scalar, if true will return the left, else return the right one.
  
      :param expr: sequence or scalar
      :param true_expr:
      :param false_expr:
      :return: sequence or scalar
  
      :Example:
  
      >>> (df.id == 3).ifelse(df.id, df.fid.astype('int'))
      >>> df.isMale.ifelse(df.male_count, df.female_count)