def _PrepareRegex(pattern):
  try:
    return re.compile(pattern)
  except re.error, err:
    raise errors.ParameterError("Invalid regex pattern (%s)" % err)
Finds the previous digest key (either the last or before before_key)
dataset/ETHPy150Open ganeti/ganeti/lib/query.py/_PrepareRegex--crossover with--dataset/ETHPy150Open aws/aws-cli/awscli/customizations/cloudtrail/validation.py/DigestTraverser._get_last_digest