<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _assertField(self, fieldname):
 """Raise AttributeError when Packet has no field with the given name."""

        if not self._hasattr(fieldname):
            values = self._defn.name, fieldname
            raise AttributeError("Packet '%s' has no field '%s'" % values)