def call_formatter(cmd, input):
    """
    Return the formatted version of the given file.
    """
    from subprocess import Popen, PIPE, CalledProcessError
    import logging
    logging.debug('calling %r', cmd)
    p = Popen(cmd, stdout=PIPE, stdin=PIPE, stderr=PIPE)
    out, err = p.communicate(input)
    if p.returncode:
        raise CalledProcessError(p.returncode, cmd, err)
    return out
