import hashlib


def generate_hash(my_file):
    """
    Generates the md5 hash of my_file.
    """
    try:
        with open(my_file, 'rb') as current_file:
            buffered_file = current_file.read()
            hasher = hashlib.md5()
            hasher.update(buffered_file)
    
        return hasher.hexdigest()
    except PermissionError:
        return None
    except FileNotFoundError:
        print(f"{my_file=} does not exist")
        return None