Please be informed that you can achieve your output, by either tag or segment - while setting those two up may be quite different and that's a different conversation - querying by either of them is quite similar.
You can obtain the selected users/leads by asking the user's resource with a segment_id parameter, showing the id of the segment to query with.
To fetch marked users/leads, you can apply a tag_id parameter to symbolize that the id of the tag. For data on tagging users see the section 'Tag or Untag Users'.
If you're working with python-intercom, then your command may look like this:
intercom.users.find(tag_id=3142) OR intercom.users.find(segment_id=5926)
Interested in learning Python? Enroll in our Python Course!