# Buggy code
def __new__(cls, opts, functions, returners=None, intervals=None, cleanup=None):
    """
    Only create one instance of Schedule
    """
    if cls.instance is None:
        log.debug("Initializing new Schedule")
        # we need to make a local variable for this, as we are going to store
        # it in a WeakValueDictionary-- which will remove the item if no one
        # references it-- this forces a reference while we return to the caller
        cls.instance = object.__new__(cls)
        cls.instance.__singleton_init__(opts, functions, returners, intervals, cleanup)
    else:
        log.debug("Re-using Schedule")
    return cls.instance


# Traceback (KeyError)
[INFO    ] Running scheduled job: napalm_keepalive
[DEBUG   ] schedule: This job was scheduled with jid_include, adding to cache (jid_include defaults to True)
[DEBUG   ] schedule: This job was scheduled with a max number of 2
[DEBUG   ] schedule.handle_func: adding this job to the jobcache with data {'fun_args': [], 'jid': '20170302001945879004', 'schedule': 'napalm_keepalive', 'pid': 18056, 'fun': 'napalm_proxy.reconnect', 'id': 'device1'}
[DEBUG   ] LazyLoaded napalm_proxy.reconnect
[ERROR   ] Unhandled exception running napalm_proxy.reconnect
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/utils/schedule.py", line 836, in handle_func
ret['return'] = self.functions[func](*args, **kwargs)
File "/var/cache/salt/minion/extmods/modules/napalm_proxy.py", line 101, in reconnect
is_alive = alive()
File "/var/cache/salt/minion/extmods/modules/napalm_proxy.py", line 80, in alive
return __proxy__['napalm.call'](
File "/usr/lib/python2.7/dist-packages/salt/utils/context.py", line 203, in __getitem__
return self._dict()[key]
KeyError: 'napalm.call'
[DEBUG   ] SaltEvent PUB socket URI: /var/run/salt/minion/minion_event_18faa0dd7a_pub.ipc
[DEBUG   ] SaltEvent PULL socket URI: /var/run/salt/minion/minion_event_18faa0dd7a_pull.ipc
[DEBUG   ] Initializing new IPCClient for path: /var/run/salt/minion/minion_event_18faa0dd7a_pull.ipc
[DEBUG   ] Sending event: tag = __schedule_return; data = {'fun_args': [], 'jid': 'req', 'return': 'Unhandled exception running napalm_proxy.reconnect', 'retcode': 254, 'success': False, 'schedule': 'napalm_keepalive', 'cmd': '_return', 'pid': 18056, '_stamp': '2017-03-02T00:19:45.881385', 'fun': 'napalm_proxy.reconnect', 'id': 'device1'}
[DEBUG   ] schedule.handle_func: Removing /var/cache/salt/proxy/device1/proc/20170302001945879004

# Fixed code
def __new__(
    cls, opts, functions, returners=None, intervals=None, cleanup=None, proxy=None
):
    """
    Only create one instance of Schedule
    """
    if cls.instance is None:
        log.debug("Initializing new Schedule")
        # we need to make a local variable for this, as we are going to store
        # it in a WeakValueDictionary-- which will remove the item if no one
        # references it-- this forces a reference while we return to the caller
        cls.instance = object.__new__(cls)
        cls.instance.__singleton_init__(
            opts, functions, returners, intervals, cleanup, proxy
        )
    else:
        log.debug("Re-using Schedule")
    return cls.instance