def get_digest(value):
 if (not isinstance(value, str)):
  return value
 value = value.lower()
 if (value == 'md5'):
  return md5
 elif (value == 'sha1'):
  return sha1
 elif (value == 'sha224'):
  return sha224
 elif (value == 'sha256'):
  return sha256
 elif (value == 'sha384'):
  return sha384
 elif (value == 'sha512'):
  return sha512
 else:
  raise ValueError(('Invalid digest algorithm: %s' % value))

def get_digest ( value ) : if ( not isinstance ( value , str ) ) : return value value = value . lower ( ) if ( value == 'md5' ) : return md5 elif ( value == 'sha1' ) : return sha1 elif ( value == 'sha224' ) : return sha224 elif ( value == 'sha256' ) : return sha256 elif ( value == 'sha384' ) : return sha384 elif ( value == 'sha512' ) : return sha512 else : raise ValueError ( ( 'Invalid digest algorithm: %s' % value ) )
return a hashlib digest algorithm from a string .