@classmethod
def serialize(cls, value, writer=None):
    """
        Serialize a python object to GraphSON.

        e.g 'P42DT10H5M37S'
        e.g. {'key': value}

        :param value: The python object to serialize.
        :param writer: A graphson serializer for recursive types (Optional)
        """
    serializer = cls.get_serializer(value)
    if serializer:
        return serializer.serialize(value, writer or cls)
    return value
