<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def block(self):
 """ Return the block character "s,p,d,f" """

        if (self.is_actinoid or self.is_lanthanoid) and self.Z not in [71, 103]:
            return "f"
        elif self.is_actinoid or self.is_lanthanoid:
            return "d"
        elif self.group in [1, 2]:
            return "s"
        elif self.group in range(13, 19):
            return "p"
        elif self.group in range(3, 13):
            return "d"
        raise ValueError("unable to determine block")