<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __validate_dates(start_date, end_date):
 """Validate if a date string. Validate if a string is a date on yyyy-mm-dd format and it the period between them is less than a year. """

    try:
        start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d')
        end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d')
    except ValueError:
        raise ValueError("Incorrect data format, should be yyyy-mm-dd")
    if (end_date - start_date).days > 366:
        raise ValueError("The difference between start and end date " +
                         "should be less than or equal to 366 days.")
    if (end_date - start_date).days < 0:
        raise ValueError("End date cannot be before start date.")