import hashlib
import six
import base64


def CalculateMd5Hash(file_path):
  """Calculate base64 encoded md5hash for a local file.

  Args:
    file_path: the local file path
  Returns:
    md5hash of the file.
  """
  m = hashlib.md5()
  with open(file_path, 'rb') as f:
    m.update(f.read())
  return six.ensure_text(base64.b64encode(m.digest()))