<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_platform_by_name(self, name, for_target=None):
 """Finds the platform with the given name. If the name is empty or None, returns the default platform. If not platform with the given name is defined, raises an error. :param str name: name of the platform. :param JvmTarget for_target: optionally specified target we're looking up the platform for. Only used in error message generation. :return: The jvm platform object. :rtype: JvmPlatformSettings """

    if not name:
      return self.default_platform
    if name not in self.platforms_by_name:
      raise self.UndefinedJvmPlatform(for_target, name, self.platforms_by_name)
    return self.platforms_by_name[name]