def find_machine_by_ip(machines, ip):
    """
    From a list of machines, returns the matching machine id.

    Example:

    >>> machines = [
        {
            "id": "abc",
            "primaryIP": "1.1.1.1"
        },
        {
            "id": "xyz",
            "primaryIP": "2.2.2.2"
        }
    ]
    >>> find_machine_by_ip(machine_id, "2.2.2.2")
    "xyz"
    """
    for machine in machines:
        if machine['primaryIP'] == ip:
            return machine
