<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ulid_to_binary(ulid):
 """ Convert an ULID to its binary representation. :param ulid: An ULID (either as UUID, base32 ULID or binary) :return: Bytestring of length 16 :rtype: bytes """

    if isinstance(ulid, uuid.UUID):
        return ulid.bytes
    if isinstance(ulid, (text_type, bytes)) and len(ulid) == 26:
        return decode_ulid_base32(ulid)
    if isinstance(ulid, (bytes, bytearray)) and len(ulid) == 16:
        return ulid
    raise InvalidULID('can not convert ulid %r to binary' % ulid)