Attempts to convert `value` into an ``xs:date`` string. If `value` is
    ``None``, ``None`` will be returned.

    Args:
        value: A date value. This can be a string, datetime.date, or
            datetime.datetime object.

    Returns:
        An ``xs:date`` formatted timestamp string.

def serialize_date(value):
    """Attempts to convert `value` into an ``xs:date`` string. If `value` is
    ``None``, ``None`` will be returned.

    Args:
        value: A date value. This can be a string, datetime.date, or
            datetime.datetime object.

    Returns:
        An ``xs:date`` formatted timestamp string.

    """
    if not value:
        return None
    elif isinstance(value, datetime.datetime):
        return value.date().isoformat()
    elif isinstance(value, datetime.date):
        return value.isoformat()
    else:
        return parse_date(value).isoformat()