<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_preset_by_key(self, package_keyname, preset_keyname, mask=None):
 """Gets a single preset with the given key."""

        preset_operation = '_= %s' % preset_keyname
        _filter = {
            'activePresets': {
                'keyName': {
                    'operation': preset_operation
                }
            },
            'accountRestrictedActivePresets': {
                'keyName': {
                    'operation': preset_operation
                }
            }
        }

        presets = self.list_presets(package_keyname, mask=mask, filter=_filter)

        if len(presets) == 0:
            raise exceptions.SoftLayerError(
                "Preset {} does not exist in package {}".format(preset_keyname,
                                                                package_keyname))

        return presets[0]