def maybe_id_ref(node):
    """Return the node id as a string if available, prefixed by space,
    otherwise an empty string.

    """
    node_id = node.get('id')
    if node_id is not None:
        return " (id=%s)" % node_id
    return ""