code: def from_sdp(cls, sdp):
          
          bits = sdp.split()
          if len(bits) < 8:
              raise ValueError('SDP does not have enough properties')
  
          kwargs = {
              'foundation': bits[0],
              'component': int(bits[1]),
              'transport': bits[2],
              'priority': int(bits[3]),
              'host': bits[4],
              'port': int(bits[5]),
              'type': bits[7],
          }
  
          for i in range(8, len(bits) - 1, 2):
              if bits[i] == 'raddr':
                  kwargs['related_address'] = bits[i + 1]
              elif bits[i] == 'rport':
                  kwargs['related_port'] = int(bits[i + 1])
              elif bits[i] == 'tcptype':
                  kwargs['tcptype'] = bits[i + 1]
              elif bits[i] == 'generation':
                  kwargs['generation'] = int(bits[i + 1])
  
          return Candidate(**kwargs)
docs: Parse a :class:`Candidate` from SDP.
  
          .. code-block:: python
  
             Candidate.from_sdp(
              '6815297761 1 udp 659136 1.2.3.4 31102 typ host generation 0')