def GetNBits(value, nbits):
<EOL>if isinstance(value, int):<EOL><INDENT>return Operators.EXTRACT(value, <NUM_LIT:0>, nbits)<EOL><DEDENT>elif isinstance(value, BitVec):<EOL><INDENT>if value.size < nbits:<EOL><INDENT>return Operators.ZEXTEND(value, nbits)<EOL><DEDENT>else:<EOL><INDENT>return Operators.EXTRACT(value, <NUM_LIT:0>, nbits)<EOL><DEDENT><DEDENT>
Get the first `nbits` from `value`.

:param value: Source value from which to extract
:type value: int or long or BitVec
:param int nbits: How many bits to extract
:return: Low `nbits` bits of `value`.
:rtype int or long or BitVec