import hashlib


def validate_md5(local_path, md5):
    """
    Computes the md5 checksum of a file and compares it to the passed md5
    checksum
    """
    with open(local_path, "rb") as in_f:
        md5_file = hashlib.md5(in_f.read()).hexdigest()
        if md5_file != md5:
            return False
        else:
            return True