REF: rename 'labels' to 'codes' in algorithms.safe_sort and ._factorize
Finishes up the renaming started by #29509 in ``core.algorithms`` of 'labels' to 'codes.' Also renames in  related tests.
thanks @topper-123 if you'd like to followup with typing where indicated would be great.