<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compare(a, b):
 """Compares two timestamps. ``a`` and ``b`` must be the same type, in addition to normal representations of timestamps that order naturally, they can be rfc3339 formatted strings. Args: a (string|object):
 a timestamp b (string|object):
 another timestamp Returns: int: -1 if a < b, 0 if a == b or 1 if a > b Raises: ValueError: if a or b are not the same type ValueError: if a or b strings but not in valid rfc3339 format """

    a_is_text = isinstance(a, basestring)
    b_is_text = isinstance(b, basestring)
    if type(a) != type(b) and not (a_is_text and b_is_text):
        _logger.error(u'Cannot compare %s to %s, types differ %s!=%s',
                      a, b, type(a), type(b))
        raise ValueError(u'cannot compare inputs of differing types')

    if a_is_text:
        a = from_rfc3339(a, with_nanos=True)
        b = from_rfc3339(b, with_nanos=True)

    if a < b:
        return -1
    elif a > b:
        return 1
    else:
        return 0