bisect_left is documented by link. Basically, it returns the index to of sorted list to keep the list sorted.

bisect.bisect_left(a, x, lo=0, hi=len(a), *, key=None) Locate the insertion point for x in a to maintain sorted order. The parameters lo and hi may be used to specify a subset of the list which should be considered; by default the entire list is used. If x is already present in a, the insertion point will be before (to the left of) any existing entries. The return value is suitable for use as the first parameter to list.insert() assuming that a is already sorted.

Well, bisect_right is the same but puts the duplicate element to the right.

bisect.bisect_right(a, x, lo=0, hi=len(a), *, key=None) bisect.bisect(a, x, lo=0, hi=len(a), *, key=None) Similar to bisect_left(), but returns an insertion point which comes after (to the right of) any existing entries of x in a.

Small and quick example of bisect_right and bisect_left

In [7]: bisect.bisect_right([2,4,6,8], 6)
Out[7]: 3

In [8]: bisect.bisect_left([2,4,6,8], 6)
Out[8]: 2