Metadata filtering logic in it's current form is tightly coupled with
compute code. To make this filtering logic usable for filtering
metadata of other resources, it is being moved to utils.py file. The
filtering metadata logic is going to be used for filtering volume and
volume snapshot metadata in the EC2 API, at the very least.
There were no unit tests present at all to test the filtering logic.
Those have been added too, and in the process of writing unit tests,
a bug was found: a single character value of a resource metadata
(e.g. 'c') matches when a filter is specified which contains
that character as a part of input matching string (e.g.
all resources which has a metadata value = 'taco')
The bug has also been fixed, and accompanying testcase added
Closes-Bug: 1364758
Closes-Bug: 1365887
Change-Id: Ie9dbb50b79c042e49ef7eaba831280e175cc1e7f