def search_postcode(postcode_array, postcode):
    """Searches an element with a specified postcode attribute in a given array."""

    for element in postcode_array:
        if element.postcode == postcode:
            return element