from pathlib import Path
import hashlib


def get_md5(file_path: Path):
    """
    Returns MD5 hash on given file, returns None if file does not exist or no MD5 hash generated

    :param file_path: Path of the file to be checked. Full or relative
    :return: (MD5 hashcode)
    """

    file_name = str(file_path)
    try:
        with open(file_name, "rb") as file_to_check:
            # read contents of the file as binary
            data = file_to_check.read()
            # pipe contents of the file through
            return hashlib.md5(data).hexdigest()
    except FileNotFoundError:
        print(f"{file_name}: file not found")
        return None