socket.getservbyname()

socket.getservbyname(servicename[, protocolname]) → integer

Return a port number from a service name and protocol name. The optional protocol name, if given, should be ‘tcp’ or ‘udp’, otherwise any protocol will match.