import hashlib


def string_to_md5(content):
    """Calculate the md5 hash of a string.

    This 'string' can be the binary content of a file too."""
    content = content.encode("utf8")
    return hashlib.md5(content).hexdigest()