def progress_bar(progress, length=20):
    """
    Returns a textual progress bar.
    
    >>> progress_bar(0.6)
    '[##########--------]'
    
    :param progress: Number between 0 and 1 describes the progress.
    :type progress: float
    :param length: The length of the progress bar in chars. Default is 20.
    :type length: int
    :rtype: string
    """
    length -= 2
    if progress < 0:
        progress = 0
    if progress > 1:
        progress = 1
    return '[' + '#' * int(progress * length) + '-' * (length - int(
        progress * length)) + ']'
