public function add_unit($questiondata, $answer, $unit = null) {
        if (is_null($unit)) {
            $unit = $this->get_default_numerical_unit($questiondata);
        }

        if (!$unit) {
            return $answer;
        }

        if (!empty($questiondata->options->unitsleft)) {
            return $unit->unit . ' ' . $answer;
        } else {
            return $answer . ' ' . $unit->unit;
        }
    }