Any district court of the United States, or the United States courts of any Territory or possession, within the jurisdiction of which proceedings are had before any service court of a friendly foreign force, or within the jurisdiction of which any person is found, shall have jurisdiction, upon application made by a service court of a friendly foreign force, to issue to such person an order requiring him to appear before the service court or an officer designated to take a deposition for use before such service court and there to produce evidence or give testimony if so ordered. Any failure to obey such order of the court may be punished by said court as a contempt thereof: Provided, That the fees of such witnesses and the mileage at the rate allowed to witnesses attending the courts of the United States should be duly paid or tendered in advance to such witnesses, with funds to be supplied by the friendly foreign force. Except as expressly permitted by the court, in its discretion, no such order shall run into any other district.