<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_id(package, size):
 """Get the preset id given the keyName of the preset."""

    for preset in package['activePresets'] + package['accountRestrictedActivePresets']:
        if preset['keyName'] == size or preset['id'] == size:
            return preset['id']

    raise SoftLayer.SoftLayerError("Could not find valid size for: '%s'" % size)