import hashlib


def get_hash(namespace):
  """Returns an initialized hashlib object that corresponds to the namespace."""
  if namespace.startswith('sha256-'):
    return hashlib.sha256()
  if namespace.startswith('sha512-'):
    return hashlib.sha512()
  return hashlib.sha1()