    def validate_username(self, username):
        """Validate a normalized username

        Return True if username is valid, False otherwise.
        """
        if '/' in username:
            # / is not allowed in usernames
            return False
        if not username:
            # empty usernames are not allowed
            return False
        if username != username.strip():
            # starting/ending with space is not allowed
            return False
        if not self.username_regex:
            return True
        return bool(self.username_regex.match(username))
Validate a normalized username

Return True if username is valid, False otherwise.
jupyterhub/auth.py