def extract_numbers(value, type=str):
    """Extracts numbers only from a string."""

    def extract(vs):
        for v in vs:
            if v in "01234567890.":
                yield v

    return type("".join(extract(value)))