'Given a a list of functions and a schedule to execute them,
setup up regular execution.'

def schedule(self):

    events = self.stage_config.get(u'events', [])
    if events:
        if (not isinstance(events, list)):
            print u'Events    must    be    supplied    as    a    list.'
            return
    for event in events:
        self.collision_warning(event.get(u'function'))
    if self.stage_config.get(u'keep_warm', True):
        if (not events):
            events = []
        keep_warm_rate = self.stage_config.get(u'keep_warm_expression', u'rate(4    minutes)')
        events.append({u'name': u'zappa-keep-warm', u'function': u'handler.keep_warm_callback', u'expression': keep_warm_rate, u'description': u'Zappa    Keep    Warm    -    {}'.format(self.lambda_name)})
    if events:
        try:
            function_response = self.zappa.lambda_client.get_function(FunctionName=self.lambda_name)
        except botocore.exceptions.ClientError as e:
            click.echo(((((click.style(u'Function    does    not    exist', fg=u'yellow') + u',    please    ') + click.style(u'deploy', bold=True)) + u'first.    Ex:') + click.style(u'zappa    deploy    {}.'.format(self.api_stage), bold=True)))
            sys.exit((-1))
        print u'Scheduling..'
        self.zappa.schedule_events(lambda_arn=function_response[u'Configuration'][u'FunctionArn'], lambda_name=self.lambda_name, events=events)
    if ((self.stage_config.get(u'async_source', None) == u'sns') and self.stage_config.get(u'async_resources', True)):
        self.lambda_arn = self.zappa.get_lambda_function(function_name=self.lambda_name)
        topic_arn = self.zappa.create_async_sns_topic(lambda_name=self.lambda_name, lambda_arn=self.lambda_arn)
        click.echo((u'SNS    Topic    created:    %s' % topic_arn))
