<s> from django . core . management . base import BaseCommand , CommandError <EOL> try : <EOL> from django . contrib . auth import get_user_model <EOL> except ImportError : <EOL> from django . contrib . auth . models import User <EOL> else : <EOL> User = get_user_model ( ) <EOL> from django_otp import devices_for_user <EOL> class Command ( BaseCommand ) : <EOL> """<STR_LIT>""" <EOL> args = '<STR_LIT>' <EOL> help = '<STR_LIT>' <EOL> def handle ( self , * args , ** options ) : <EOL> for username in args : <EOL> try : <EOL> user = User . objects . get_by_natural_key ( username ) <EOL> except User . DoesNotExist : <EOL> raise CommandError ( '<STR_LIT>' % username ) <EOL> for device in devices_for_user ( user ) : <EOL> device . delete ( ) </s>
