<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hex_color(self, safe: bool = False) -> str: """Generate a random hex color. :param safe: Get safe Flat UI hex color. :return: Hex color code. :Example: #d8346b """

        if safe:
            return self.random.choice(SAFE_COLORS)

        return '#{:06x}'.format(
            self.random.randint(0x000000, 0xffffff))