@classmethod
def construct_from_string(cls, string: str):
    """
        Construct this type from a string.

        This is useful mainly for data types that accept parameters.
        For example, a period dtype accepts a frequency parameter that
        can be set as ``period[H]`` (where H means hourly frequency).

        By default, in the abstract class, just the name of the type is
        expected. But subclasses can overwrite this method to accept
        parameters.

        Parameters
        ----------
        string : str
            The name of the type, for example ``category``.

        Returns
        -------
        ExtensionDtype
            Instance of the dtype.

        Raises
        ------
        TypeError
            If a class cannot be constructed from this 'string'.

        Examples
        --------
        For extension dtypes with arguments the following may be an
        adequate implementation.

        >>> @classmethod
        ... def construct_from_string(cls, string):
        ...     pattern = re.compile(r"^my_type\\[(?P<arg_name>.+)\\]$")
        ...     match = pattern.match(string)
        ...     if match:
        ...         return cls(**match.groupdict())
        ...     else:
        ...         raise TypeError(f"Cannot construct a '{cls.__name__}' from
        ...             " "'{string}'")
        """
    if not isinstance(string, str):
        raise TypeError(f'Expects a string, got {type(string).__name__}')
    assert isinstance(cls.name, str), (cls, type(cls.name))
    if string != cls.name:
        raise TypeError(f"Cannot construct a '{cls.__name__}' from '{string}'")
    return cls()
