<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_monitor(module):
 """ Defines the monitor method on the module. """

    def monitor(name, tensor,
                track_data=True,
                track_grad=True):
        """
        Register the tensor under the name given (now a string)
        and track it based on the track_data and track_grad arguments.
        """
        module.monitored_vars[name] = {
            'tensor':tensor,
            'track_data':track_data,
            'track_grad':track_grad,
        }
    module.monitor = monitor