code: def shrink_pool(arg, opts, shell_opts):
      
      if not pool:
          print("No pool with name '%s' found." % arg, file=sys.stderr)
          sys.exit(1)
  
      if 'remove' in opts:
          res = Prefix.list({'prefix': opts['remove'], 'pool_id': pool.id})
  
          if len(res) == 0:
              print("Pool '%s' does not contain %s." % (pool.name,
                  opts['remove']), file=sys.stderr)
              sys.exit(1)
  
          res[0].pool = None
          res[0].save()
          print("Prefix %s removed from pool '%s'." % (res[0].prefix, pool.name))
      else:
          print("Please supply a prefix to add or remove to '%s':" % (
              pool.name), file=sys.stderr)
          for pref in Prefix.list({'pool_id': pool.id}):
              print("  %s" % pref.prefix)
docs: Shrink a pool by removing the ranges in opts from it