code: def get_port_from_address(address: str) -> int:
      """Returns the port from a given address.
  
      Note that Launchpad uses a convention where named ports are passed as
      environment variables. For example, for the named port 'baz', the actual port
      value will be stored in LP_PORT_baz environment variable.
  
      Args:
        address: address with a named port or a host:port address.
  
      Returns:
        The port number as an integer.
      """
      port_name = address.split(":")[-1]
      if port_name.isdigit():
          return int(port_name)
      else:
          return int(os.environ["LP_PORT_" + port_name])
  
file_path: launchpad/launchpad/address.py
imports: import abc
  import os
  import re
  from typing import Optional
  from absl import logging
  import portpicker
label_desc: Use image node_id 1 for calling a global function with example usage: get_port_from_address(address) and returns: int, int