Factory: create a FieldPath from a unicode string representation.

        This method splits on the character `.` and disallows the
        characters `~*/[]`. To create a FieldPath whose components have
        those characters, call the constructor.

        Args:
            path_string (str): A unicode string which cannot contain
            `~*/[]` characters, cannot exceed 1500 bytes, and cannot be empty.

        Returns:
            (:class:`FieldPath`) An instance parsed from ``path_string``.

def from_string(cls, path_string):
        """Factory: create a FieldPath from a unicode string representation.

        This method splits on the character `.` and disallows the
        characters `~*/[]`. To create a FieldPath whose components have
        those characters, call the constructor.

        Args:
            path_string (str): A unicode string which cannot contain
            `~*/[]` characters, cannot exceed 1500 bytes, and cannot be empty.

        Returns:
            (:class:`FieldPath`) An instance parsed from ``path_string``.
        """
        try:
            return cls.from_api_repr(path_string)
        except ValueError:
            elements = path_string.split(".")
            for element in elements:
                if not element:
                    raise ValueError("Empty element")
                if _LEADING_ALPHA_INVALID.match(element):
                    raise ValueError(
                        "Non-alphanum char in element with leading alpha: {}".format(
                            element
                        )
                    )
            return FieldPath(*elements)