<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bar(msg='', width=40, position=None):
 r""" Returns a string with text centered in a bar caption. Examples: '== test ==' '==========' """

    if position == 'top':
        start_bar = '//'
        end_bar = r'\\'
    elif position == 'bottom':
        start_bar = r'\\'
        end_bar = '//'
    else:
        start_bar = end_bar = '=='

    if msg:
        msg = ' ' + msg + ' '

    width -= 4

    return start_bar + msg.center(width, '=') + end_bar