REF: Refactor for DRY. Handle numpy-like like numpy.