<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_policy(self):
 """Wrapper function. Gets the server group, sets sane defaults, deletes existing policies, and then runs self.prepare_policy_template for scaling up and scaling down policies. This function acts as the main driver for the scaling policy creationprocess """

        if not self.settings['asg']['scaling_policy']:
            self.log.info("No scaling policy found, skipping...")
            return

        server_group = self.get_server_group()

        # Find all existing and remove them
        scaling_policies = self.get_all_existing(server_group)
        for policy in scaling_policies:
            for subpolicy in policy:
                self.delete_existing_policy(subpolicy, server_group)

        if self.settings['asg']['scaling_policy']['period_minutes']:
            period_sec = int(self.settings['asg']['scaling_policy']['period_minutes']) * 60
        else:
            period_sec = 1800

        self.prepare_policy_template('scale_up', period_sec, server_group)
        if self.settings['asg']['scaling_policy'].get('scale_down', True):
            self.prepare_policy_template('scale_down', period_sec, server_group)