def md5sum(data):
    """
    Return md5sum of data as a 32-character string.

    >>> md5sum('random text')
    'd9b9bec3f4cc5482e7c5ef43143e563a'
    >>> md5sum(u'random text')
    'd9b9bec3f4cc5482e7c5ef43143e563a'
    >>> len(md5sum('random text'))
    32
    """
    if six.PY3:  # pragma: no cover
        return hashlib.md5(data.encode('utf-8')).hexdigest()
    else:  # pragma: no cover
        return hashlib.md5(data).hexdigest()