extract line_identity related function to lib-python
Merge '4205-history-performance-3'