def SortSpans(spans):
    ''' Sort the spans of a line in ascending horizontal direction. See comment
    in SortBlocks function.
    '''
    sspans = []
    for s in spans:
        x0 = str(int(s["bbox"][0] + 0.99999)).rjust(4,"0")
        sspans.append([x0, s])
    sspans.sort()
    return [s[1] for s in sspans]
 Sort the spans of a line in ascending horizontal direction. See comment
    in SortBlocks function.
    
recipes/Python/580626_PDF_Text_Extractiusing_fitz__MuPDF/recipe-580626.py