def get_annotation_name(annotation: object) -> str:
            """
            Get annotation as string from inspect signature.
            """
            try:
                # In case the annotation is a class like "int", "float", ...
                return str(annotation.__name__)  # type: ignore
            except AttributeError:
                pass  # No attribute `__name__`, e.g., in case of `List[int]`.

            annotation = str(annotation)
            if annotation.startswith("typing."):
                annotation = annotation[len("typing:") :]
            return annotation

            Get annotation as string from inspect signature.
            
src/ptpython/signatures.py