<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate_policy(topic, signer, routing_policy, nitpicky=False):
 """ Checks that the sender is allowed to emit messages for the given topic. Args: topic (str):
 The message topic the ``signer`` used when sending the message. signer (str):
 The Common Name of the certificate used to sign the message. Returns: bool: True if the policy defined in the settings allows the signer to send messages on ``topic``. """

    if topic in routing_policy:
        # If so.. is the signer one of those permitted senders?
        if signer in routing_policy[topic]:
            # We are good.  The signer of this message is explicitly
            # whitelisted to send on this topic in our config policy.
            return True
        else:
            # We have a policy for this topic and $homeboy isn't on the list.
            _log.error("Authorization/routing_policy error.  "
                       "Topic %r.  Signer %r." % (topic, signer))
            return False
    else:
        # We don't have a policy for this topic.  How we react next for an
        # underspecified routing_policy is based on a configuration option.

        # Ideally, we are in nitpicky mode.  We leave it disabled while
        # standing up fedmsg across our environment so that we can build our
        # policy without having the whole thing come crashing down.
        if nitpicky:
            # We *are* in nitpicky mode.  We don't have an entry in the
            # routing_policy for the topic of this message.. and *nobody*
            # gets in without a pass.  That means that we fail the message.
            _log.error("Authorization/routing_policy underspecified.")
            return False
        else:
            # We are *not* in nitpicky mode.  We don't have an entry in the
            # routing_policy for the topic of this message.. but we don't
            # really care.
            _log.warning('No routing policy defined for "{t}" but routing_nitpicky is '
                         'False so the message is being treated as authorized.'.format(t=topic))
            return True