from datetime import datetime


def _safe_string_to_date(dstring):
    """
    tvdb format date '2004-11-12' to python datetime.date
    Returns None in case of failure.
    """
    try:        
        dt = datetime.strptime(dstring, '%Y-%m-%d')
    except (ValueError, TypeError):
        return None
    else:
        return dt.date()