<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_string(cls, pid):
 """Parse a PID from its string representation. PIDs may be represented as name@ip:port, e.g. .. code-block:: python pid = PID.from_string('master(1)@192.168.33.2:5051') :param pid: A string representation of a pid. :type pid: ``str`` :return: The parsed pid. :rtype: :class:`PID` :raises: ``ValueError`` should the string not be of the correct syntax. """

    try:
      id_, ip_port = pid.split('@')
      ip, port = ip_port.split(':')
      port = int(port)
    except ValueError:
      raise ValueError('Invalid PID: %s' % pid)
    return cls(ip, port, id_)