from unittest.mock import call


def execute(command, stdout=None, stderr=None):
    """
    Run a command via the operating system.

    :param command: Command to run plus any arguments
    :type command: list of str or unicode
    :param stdout: File for standard output stream
    :type stdout: file
    :param stderr: File for standard error stream
    :type stderr: file
    :return: exit code
    :rtype: int
    :raises OSError: if there are problems running the command
    """
    print((" ".join(command)))
    return_code = call(command, stdout=stdout, stderr=stderr)
    return return_code