<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reconfigure_bird(cmd):
 """Reconfigure BIRD daemon. Arguments: cmd (string):
 A command to trigger a reconfiguration of Bird daemon Notes: Runs 'birdc configure' to reconfigure BIRD. Some useful information on how birdc tool works: -- Returns a non-zero exit code only when it can't access BIRD daemon via the control socket (/var/run/bird.ctl). This happens when BIRD daemon is either down or when the caller of birdc doesn't have access to the control socket. -- Returns zero exit code when reconfigure fails due to invalid configuration. Thus, we catch this case by looking at the output and not at the exit code. -- Returns zero exit code when reconfigure was successful. -- Should never timeout, if it does then it is a bug. """

    log = logging.getLogger(PROGRAM_NAME)
    cmd = shlex.split(cmd)
    log.info("reconfiguring BIRD by running %s", ' '.join(cmd))
    try:
        output = subprocess.check_output(
            cmd,
            timeout=2,
            stderr=subprocess.STDOUT,
            universal_newlines=True,
            )
    except subprocess.TimeoutExpired:
        log.error("reconfiguring bird timed out")
        return
    except subprocess.CalledProcessError as error:
        # birdc returns 0 even when it fails due to invalid config,
        # but it returns 1 when BIRD is down.
        log.error("reconfiguring BIRD failed, either BIRD daemon is down or "
                  "we don't have privileges to reconfigure it (sudo problems?)"
                  ":%s", error.output.strip())
        return
    except FileNotFoundError as error:
        log.error("reconfiguring BIRD failed with: %s", error)
        return

    # 'Reconfigured' string will be in the output if and only if conf is valid.
    pattern = re.compile('^Reconfigured$', re.MULTILINE)
    if pattern.search(str(output)):
        log.info('reconfigured BIRD daemon')
    else:
        # We will end up here only if we generated an invalid conf
        # or someone broke bird.conf.
        log.error("reconfiguring BIRD returned error, most likely we generated"
                  " an invalid configuration file or Bird configuration in is "
                  "broken:%s", output)