'Tries to write an object reference, adding it to the references
table. Does not write the actual object bytes or set the reference
position. Returns a tuple of whether the object was a new reference
(True if it was, False if it already was in the reference table)
and the new output.'

def writeObjectReference(self, obj, output):

    position = self.positionOfObjectReference(obj)
    if (position is None):
        self.writtenReferences[obj] = len(self.writtenReferences)
        output += self.binaryInt((len(self.writtenReferences) - 1), byteSize=self.trailer.objectRefSize)
        return (True, output)
    else:
        output += self.binaryInt(position, byteSize=self.trailer.objectRefSize)
        return (False, output)
