<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def decode(self, name):
 """Translate a target name into its integer code. 299 Raises ``ValueError`` if you supply an unknown name, or ``KeyError`` if the target is missing from this kernel. You can supply an integer code if you already have one and just want to check whether it is present in this kernel. """

        if isinstance(name, int):
            code = name
        else:
            name = name.upper()
            code = _targets.get(name)
            if code is None:
                raise ValueError('unknown SPICE target {0!r}'.format(name))
        if code not in self.codes:
            targets = ', '.join(_format_code_and_name(c) for c in self.codes)
            raise KeyError('kernel {0!r} is missing {1!r} -'
                           ' the targets it supports are: {2}'
                           .format(self.filename, name, targets))
        return code