Mimic the get_partition_type implementation after get_partition_uuid
and factorize them to reduce the code footprint.
The get_partition_type implementation is based on blkid: it is complex
and fragile. Since sgdisk is consistently used to create partitions, use
it instead. It is already used for get_partition_uuid and there does not
seem to be any reason for concern.