ArcGIS Enterprise SDK has something like this:
public void QueryTangent ( esriSegmentExtension extension, double DistanceAlongCurve, bool asRatio, double Length, ILine tangent );
Given a distance along the curve specified either as a ratio of the length or as a specific fixed distance, QueryTangent returns the Line tangent to the Point.
I wonder if anything like this exists in QGIS Python API? If not, is it possible to implement this function from scratch?