<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_gtapp(gtapp, **kwargs):
 """Update the parameters of the object that can run ScienceTools applications Parameters gtapp : `GtApp.GtApp` Object that will run the application in question kwargs : arguments used to invoke the application """

    for key, val in kwargs.items():
        if key in ['pfiles', 'scratch']:
            continue
        if val is None:
            continue
        try:
            gtapp[key] = val
        except ValueError:
            raise ValueError(
                "gtapp failed to set parameter %s %s" % (key, val))
        except KeyError:
            raise KeyError("gtapp failed to set parameter %s %s" % (key, val))