from uuid import uuid4 def get_safe_repr(token: str) -> str: """ Returns 10 chars from signature part of the token string or 10 chars from other string. """ if not token: return "" parts = token.split(".") if len(parts) == 3: return f"{parts[2][:10]}**" return f"{token[:10]}**" def get_uid_str() -> str: """Generates random string using uuid4.""" return uuid4().hex