def isgrashof(l1,l2,l3,l4):
    """
    Determine if a four-bar linkage is Grashof class.
    """
    links = [l1,l2,l3,l4]
    S = min(links) # Shortest link
    L = max(links) # Largest link
    idxL = links.index(L)
    idxS = links.index(S)
    P, Q = [links[idx] for idx in range(len(links)) if not(idx in (idxL,idxS))] #other links
    if (S + L) <= (P + Q): # Checks Grashof condition
        return True
    else:
        return False