<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _raise_on_bad_jar_filename(jar_filename):
 """Ensure that jar_filename is a valid path to a jar file."""

        if jar_filename is None:
            return

        if not isinstance(jar_filename, string_type):
            raise TypeError("jar_filename is not a string: %r" % jar_filename)

        if not os.path.exists(jar_filename):
            raise ValueError("jar_filename does not exist: %r" % jar_filename)