<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def limtype(msmt):
 """Return -1 if this value is some kind of upper limit, 1 if this value is some kind of lower limit, 0 otherwise."""


    if np.isscalar(msmt):
        return 0
    if isinstance(msmt, Uval):
        return 0
    if isinstance(msmt, Lval):
        if msmt.kind == 'undef':
            raise ValueError('no simple limit type for Lval %r' % msmt)

        # Quasi-hack here: limits of ('tozero', [positive number]) are
        # reported as upper limits. In a plot full of fluxes this would be
        # what makes sense, but note that this would be misleading if the
        # quantity in question was something that could go negative.
        p = msmt._polarity()
        if p == -2 or p == 1:
            return -1
        if p == 2 or p == -1:
            return 1
        return 0
    if isinstance(msmt, Textual):
        return msmt.limtype()
    raise ValueError('don\'t know how to treat %r as a measurement' % msmt)