def progress_bar(progress, size = 20):
    """
    Returns an ASCII progress bar.

    :param progress: A floating point number between 0 and 1 representing the
            progress that has been completed already.
    :param size: The width of the bar.

    .. code-block:: python

        >>> ui.progress_bar(0.5, 10)
        '[####    ]'

    """

    size -= 2
    if size <= 0:
        raise ValueError("size not big enough.")

    if progress < 0:
        return "[" + "?" * size + "]"
    else:
        progress = min(progress, 1)
        done = int(round(size * progress))
        return "[" + "#" * done + " " * (size - done) + "]"