code: def clear_model(model, dry_run=True, verbosity=1):
      '''Delete all data records in a model, obeying `clear`, `dry_run`, and `verbosity` flags
      
      If a clear was requested (dry_run or otherwise), return the number of records deleted (# before minus # after)
      '''
      N_existing = model.objects.count()
      if dry_run:
          print "DRY_RUN: NOT deleting %d records in %r." % (model.objects.all().count(), model)
      if N_existing:
          ans = 'y'
          if verbosity and not dry_run:
              ans = raw_input('Are you sure you want to delete all %d existing database records in %r? (y/n) ' % (N_existing, model))
          if ans.lower().startswith('y') and not dry_run:
              model.objects.all().delete()
          return N_existing - model.objects.count()
      return f clear_model(model, dry_run=True, verbosity=1):
      '''Delete all data records in a model, obeying `clear`, `dry_run`, and `verbosity` flags
      
      If a clear was requested (dry_run or otherwise), return the number of records deleted (# before minus # after)
      '''
      N_existing = model.objects.count()
      if dry_run:
          print "DRY_RUN: NOT deleting %d records in %r." % (model.objects.all().count(), model)
      if N_existing:
          ans = 'y'
          if verbosity and not dry_run:
              ans = raw_input('Are you sure you want to delete all %d existing database records in %r? (y/n) ' % (N_existing, model))
          if ans.lower().startswith('y') and not dry_run:
              model.objects.all().delete()
          return N_existing - model.objects.count()
      return 0
docs: Delete all data records in a model, obeying `clear`, `dry_run`, and `verbosity` flags
      
      If a clear was requested (dry_run or otherwise), return the number of records deleted (# before minus # after)