def is_tty(stream):
    """Returns True if the given stream is a tty, else False

    :param stream: object to be checked for being a tty
    :returns: True if the given object is a tty, otherwise False
    :rtype: bool
    """
    return hasattr(stream, 'isatty') and stream.isatty()