code: def default_policy(policy='deny', direction='incoming'):
      
      if policy not in ['allow', 'deny', 'reject']:
          raise UFWError(('Unknown policy %s, valid values: '
                          'allow, deny, reject') % policy)
  
      if direction not in ['incoming', 'outgoing', 'routed']:
          raise UFWError(('Unknown direction %s, valid values: '
                          'incoming, outgoing, routed') % direction)
  
      output = subprocess.check_output(['ufw', 'default', policy, direction],
                                       universal_newlines=True,
                                       env={'LANG': 'en_US',
                                            'PATH': os.environ['PATH']})
      hookenv.log(output, level='DEBUG')
  
      m = re.findall("^Default %s policy changed to '%s'\n" % (direction,
                                                               policy),
                     output, re.M)
      if len(m) == 0:
          hookenv.log("ufw couldn't change the default policy to %s for %s"
                      % (policy, direction), level='WARN')
          return False
      else:
          hookenv.log("ufw default policy for %s changed to %s"
                      % (direction, policy), level='INFO')
          return True
docs: Changes the default policy for traffic `direction`
  
      :param policy: allow, deny or reject
      :param direction: traffic direction, possible values: incoming, outgoing,
                        routed