<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def solc_arguments(libraries=None, combined='bin,abi', optimize=True, extra_args=None):
 """ Build the arguments to call the solc binary. """

    args = [
        '--combined-json', combined,
    ]

    def str_of(address):
        """cast address to string. py2/3 compatability. """
        try:
            return address.decode('utf8')
        except AttributeError:
            return address


    if optimize:
        args.append('--optimize')

    if extra_args:
        try:
            args.extend(shlex.split(extra_args))
        except BaseException:  # if not a parseable string then treat it as a list
            args.extend(extra_args)

    if libraries is not None and len(libraries):
        addresses = [
            '{name}:{address}'.format(
                name=name, address=str_of(address))
            for name, address in libraries.items()
        ]
        args.extend([
            '--libraries',
            ','.join(addresses),
        ])

    return args