<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def istriangular(am):
 r""" Returns ``True`` is the sparse adjacency matrix is either upper or lower triangular """

    if am.format != 'coo':
        am = am.tocoo(copy=False)
    return istril(am) or istriu(am)