def pool_hash_and_name(job_flow):
    """Return the hash and pool name for the given job flow, or
    ``(None, None)`` if it isn't pooled."""
    bootstrap_actions = getattr(job_flow, 'bootstrapactions', None)
    if bootstrap_actions:
        for bootstrap_action in bootstrap_actions:
            if bootstrap_action.name == 'master':
                args = [arg.value for arg in bootstrap_action.args]
                if len(args) == 2 and args[0].startswith('pool-'):
                    return args[0][5:], args[1]

    return (None, None)