User class a static method valid_username(name) returning True when name is 3-12 characters of lowercase letters/digits starting with a letter — logic that belongs *with* the class but touches no instance state. Then use it inside __init__ to raise ValueError on bad names.User.valid_username('rahul7')True
Callable straight off the class.
User('7bad')ValueError
The constructor delegates to the validator.
No self parameter at all.
name.isalnum(), name.islower() nuances: digits-only strings fail islower — check name[0].isalpha() and each char.