<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_hw_platform(self, udi):
 """Return th HW platform information from the device."""

        platform = None
        try:
            pid = udi['pid']
            if pid == '':
                self.log("Empty PID. Use the hw family from the platform string.")
                return self.raw_family
            match = re.search(self.pid2platform_re, pid)
            if match:
                platform = match.group(1)
        except KeyError:
            pass
        return platform