better authentication structure for python3