def _date_within( some_date, start_date, end_date ):
    """ 
        check if start_date <= some_date <= end_date ,
        considering inequality to be true if either 
        start_date or end_date is None
    """

    result = True # start with a truth assumption
    if start_date is not None:
        result = result and ( start_date <= some_date )

    if end_date is not None:
        result = result and ( some_date <= end_date  )

    return result