def METHOD_NAME(port):
    """
    Returns the pair (name: str, io: Union[(Input|Output|Inout), None]), where
    the second element is the pyverilog encoded type of the input, or None (if
    the port list name-only.
    """
    if isinstance(port, pyverilog.vparser.parser.Ioport):
        io = port.first
        return (io.name, io)
    if isinstance(port, pyverilog.vparser.parser.Port):
        return (port.name, None)
    # Not expected to reach here.
    raise PyverilogImportError(f"Unsupported port type: {type(port)}")