<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def nationality(self, gender: Optional[Gender] = None) -> str: """Get a random nationality. :param gender: Gender. :return: Nationality. :Example: Russian """

        nationalities = self._data['nationality']

        # Separated by gender
        if isinstance(nationalities, dict):
            key = self._validate_enum(gender, Gender)
            nationalities = nationalities[key]

        return self.random.choice(nationalities)