<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _getattr (self, fieldname, raw=False, index=None):
 """Returns the value of the given packet field name. If raw is True, the field value is only decoded. That is no enumeration substituions or DN to EU conversions are applied. """

        self._assertField(fieldname)
        value = None

        if fieldname == 'raw':
            value = createRawPacket(self)
        elif fieldname == 'history':
            value = self._defn.history
        else:
            if fieldname in self._defn.derivationmap:
                defn = self._defn.derivationmap[fieldname]
            else:
                defn = self._defn.fieldmap[fieldname]

            if isinstance(defn.type, dtype.ArrayType) and index is None:
                return createFieldList(self, defn, raw)

            if defn.when is None or defn.when.eval(self):
                if isinstance(defn, DerivationDefinition):
                    value = defn.equation.eval(self)
                elif raw or (defn.dntoeu is None and defn.expr is None):
                    value = defn.decode(self._data, raw, index)
                elif defn.dntoeu is not None:
                    value = defn.dntoeu.eval(self)
                elif defn.expr is not None:
                    value = defn.expr.eval(self)

        return value