import hashlib


def _validate_file(fpath, md5_hash):
    """
    Validate a file against a MD5 hash.

    Parameters
    ----------
    fpath: string
        Path to the file being validated
    md5_hash: string
        The MD5 hash being validated against

    Returns
    ---------
    bool
        True, if the file is valid. Otherwise False.
    """
    hasher = hashlib.md5()
    with open(fpath, "rb") as f:
        buf = f.read()
        hasher.update(buf)
    if str(hasher.hexdigest()) == str(md5_hash):
        return True
    else:
        return False