def is_perim_link(link, grid):
    """Return True if both nodes are boundaries; False otherwise.

    Examples
    --------
    >>> from landlab import HexModelGrid
    >>> import numpy as np
    >>> mg = HexModelGrid(
    ...     (3, 4), spacing=1.0, orientation="vertical", node_layout="rect"
    ... )
    >>> is_perim_link(1, mg)
    True
    >>> is_perim_link(11, mg)
    False
    """
    return grid.status_at_node[grid.node_at_link_tail[link]
        ] != grid.BC_NODE_IS_CORE and grid.status_at_node[grid.
        node_at_link_head[link]] != grid.BC_NODE_IS_CORE
