Reads the contents of the specified file.

        `filename`
            Filename to read.
        `binary`
            Set to ``True`` to indicate a binary file.

        Returns string or ``None``.

def readfile(filename, binary=False):
    """ Reads the contents of the specified file.

        `filename`
            Filename to read.
        `binary`
            Set to ``True`` to indicate a binary file.

        Returns string or ``None``.
        """

    if not os.path.isfile(filename):
        return None

    try:
        flags = 'r' if not binary else 'rb'
        with open(filename, flags) as _file:
            return _file.read()

    except (OSError, IOError):
        return None