code: def get_contract_address(cmd, contract_name, error_message = None):
      
  
      # try to get from command line argument at or contractname_at
      a = "at"
      if (hasattr(cmd.args, a) and getattr(cmd.args, a)):
          return cmd.w3.toChecksumAddress( getattr(cmd.args, a) )
  
      # try to get from command line argument contractname_at
      a = "%s_at"%contract_name.lower()
      if (hasattr(cmd.args, a) and getattr(cmd.args, a)):
          return cmd.w3.toChecksumAddress( getattr(cmd.args, a) )
  
  
      # try to get from current session configuration
      rez = cmd.config.get_session_field("current_%s_at"%(contract_name.lower()), exception_if_not_found = False)
      if rez:
          return cmd.w3.toChecksumAddress(rez)
  
      error_message = error_message or "Fail to read %s address from \"networks\", you should specify address by yourself via --%s_at parameter"%(contract_name, contract_name.lower())
      # try to take address from networks
      return read_default_contract_address(w3=cmd.w3, contract_name=contract_name)
docs: We try to get config address from the different sources.
      The order of priorioty is following:
      - command line argument (at)
      - command line argument (<contract_name>_at)
      - current session configuration (current_<contract_name>_at)
      - networks/*json