<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(fname):
 """ This function uses dciodvfy to generate a list of warnings and errors discovered within the DICOM file. :param fname: Location and filename of DICOM file. """

    validation = {
        "errors": [],
        "warnings": []
    }
    for line in _process(fname):
        kind, message = _determine(line)
        if kind in validation:
            validation[kind].append(message)
    return validation