def header_is_sorted_by_coordinate(header):
    """Return True if bam header indicates that this file is sorted by coordinate.
    """
    return 'HD' in header and 'SO' in header['HD'] and header['HD']['SO'].lower() == 'coordinate'